I want to create a new class inherited from button (Winform). I want to "remove" the Text
property and replace it by my own property :
public partial class ButtonLetter : Button
{
public char Letter
{
get
{
char _letter;
if (char.TryParse(Text, out _letter))
return _letter;
else
return ' ';
}
set
{
Text = value.ToString();
}
}
private new string Text
{
get
{
return base.Text;
}
set
{
base.Text = value;
}
}
}
But when I use this control, the designer creates this code :
this.buttonLetter1.Letter = 'A';
this.buttonLetter1.Name = "buttonLetter1";
this.buttonLetter1.Text = "buttonLetter1";
And it works, the Text
property is modify and my button contains "buttonLetter1" instead of "A".
Is there a way to mask the Text
property to prevent its access ? (In this case the property should not be visible in designer => it is considered as private)