I have created a Windows Forms Custom Control inheriting from class Button in order to get a round button:
public partial class RoundButton : Button
{
public RoundButton()
{
InitializeComponent();
Width = 16;
Height = 16;
FlatStyle = FlatStyle.Flat;
FlatAppearance.BorderSize = 0;
BackColor = SystemColors.ControlDark;
}
public sealed override Color BackColor
{
get => base.BackColor;
set => base.BackColor = value;
}
protected override void OnPaint(PaintEventArgs pe)
{
GraphicsPath grPath = new GraphicsPath();
grPath.AddEllipse(0, 0, ClientSize.Width, ClientSize.Height);
Region = new Region(grPath);
base.OnPaint(pe);
}
}
When I add the RoundButton control to a form in the designer its property Text is automatically assigned a value (roundButton1). I have tried to "clear" the property in the constructor, but that doesn't work:
Text = string.Empty;
How do I make sure that the property Text has no value when adding the control in the designer? I don't want to "clear" the property in the Properties window in the designer. The property should be "cleared" by default when added in the designer.