- 1 year ago
Remove white outline on text windows forms
To remove the white outline on text in Windows Forms, you can set the FlatStyle
property of the Label
or Button
control to FlatStyle.Flat
or FlatStyle.System
. This will prevent the control from drawing any border or focus rectangle around the text. Here's how to do it:
- Remove White Outline on Labels:
csharplabel1.FlatStyle = FlatStyle.Flat; // or FlatStyle.System
label1.FlatAppearance.BorderSize = 0;
- Remove White Outline on Buttons:
csharpbutton1.FlatStyle = FlatStyle.Flat; // or FlatStyle.System
button1.FlatAppearance.BorderSize = 0;
By setting the FlatStyle
to FlatStyle.Flat
, the control will not draw any borders or focus rectangle around the text. If you prefer to use the system default style, set FlatStyle
to FlatStyle.System
.
Additionally, if you want to remove the focus outline when the control is selected, you can set the FlatStyle
and FlatAppearance
properties together as shown in the examples above.
Keep in mind that removing the outline might affect the visual appearance of the control, so make sure it fits well with your overall user interface design.