Custom Control Overriding Command Button
- by pm_2
I am trying to create a custom command button that defaults width and height to specific settings. I have the following code:
public partial class myCommandButton : Button
{
public magCommandButton()
{
InitializeComponent();
}
[DefaultValue(840)]
public override int Width
{
get
{
return base.Width;
}
set
{
base.Width = value;
}
}
[DefaultValue(340)]
public override int Height
{
get
{
return base.Height;
}
set
{
base.Height = value;
}
}
protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaint(pe);
}
}
However, it won't compile because it tells me that I can not override Width or Height. Can anyone tell me if I'm approaching this wrongly, or if there's a way around this?