The three borderstyles of the label controls in the existing winform do not have the final effect, none, fixedsingle, and fixed3d.
To create a protruding effect, we need to inherit a label. Add:
Protected override createparams
{
Get
{
Createparams CP = base. createparams;
CP. exstyle & = (~ Nativemethods. ws_exclientedge );
CP. Style & = (~ Nativemethods. ws_border );
Switch (borderstyle)
{
Case borderstyle. fixed3d:
CP. exstyle | = nativemethods. ws_exclientedge;
Break;
Case borderstyle. fixedsingle:
CP. Style | = nativemethods. ws_border;
Break;
}
Return CP;
}
}
Public override borderstyle
{
Get
{
Return borderstyle;
}
Set
{
If (borderstyle! = Value)
{
If (! Enum. isdefined (typeof (borderstyle), value ))
{
Throw new invalidenumargumentexception ("value", (INT) value, typeof (borderstyle ));
}
Borderstyle = value;
Updatestyles ();
}
}
}
Look at the results. The above is the label.
(The code is the usercontrol code in msdn that creates a border. I don't know it in the morning)