A good web page, good, chat record, write down.
The essay published the day before, which records some resources. Due to the real access to. Net (WIN form ?) It's still relatively late, so it's still stupid till now, or it's just a second flight.
After carefully reading some resources, we finally made the first control to celebrate.
Using System;
Using System. Windows. forms;
Using System. componentmodel;
Using System. drawing;
Using System. Drawing. drawing2d;
Using System. Drawing. design;
Namespace Dividerpanel
{
/**/ /// <Summary>
///My first control.
/// </Summary>
[Toolboxitem ( True )]
[Toolboxbitmap ( Typeof (Myfirstcontrol)]
Public Class Myfirstcontrol: system. Windows. Forms. Control
{
Private System. Drawing. drawing2d. graphicspath = New Graphicspath (system. Drawing. drawing2d. fillmode. Alternate );
Private Color backcolor = Color. Black;
Public Myfirstcontrol ()
{
This . Graphicspath. addpolygon ( New Point [] {
New Point ( 10 , 0 ),
New Point ( 10 , 10 ),
New Point ( 0 , 10 ),
New Point ( 0 , 90 ),
New Point ( 10 , 90 ),
New Point ( 10 , 100 ),
New Point ( 190 , 100 ),
New Point ( 190 , 90 ),
New Point ( 200 , 90 ),
New Point ( 200 , 10 ),
New Point ( 190 , 10 ),
New Point ( 190 , 0 )
} );
This . Region = New Region (graphicspath );
}
Private Void Initializecomponent ()
{
}
Protected Override Void Onpaint (painteventargs E)
{
Lineargradientbrush B = New Lineargradientbrush ( This . Clientrectangle,
This . Backcolor, This . Backcolor, 0 , False );
E. Graphics. fillrectangle (B, This . Clientrectangle );
}
Protected Override Void Ongotfocus (eventargs E)
{
Base. Ongotfocus (E );
This. Backcolor=Color. Red;
This. Invalidate ();
}
Protected Override Void Onlostfocus (eventargs E)
{
Base. Onlostfocus (E );
This. Backcolor=Color. Black;
This. Invalidate ();
}
Protected Override Void Onclick (eventargs E)
{
Base. Onclick (E );
This. Focus ();
}
}
}