Controlling the max size of a button

We're creating base classes inherited from the standard WinForm controls. As part of a proof-of-concept, I need to demonstrate "why" this inheritance is a good thing.

One of the things I'd like to demonstrate is the enforcement of a maximum size (height and width) of a button, particularly at design time. I figured all I would need to do is override the Width and Height property, eg:

public override Width
{
get{return base.Width;}
set{if(value > 100) value=100; base.Width = value;}
}

however, the Width property is not overridable.

Any thoughts?

Rob

[598 byte] By [codefund.com] at [2007-12-16]
# 1
Override SetBoundsCore instead of the property. Add any restrictions in your override.

-mark

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Designer...
# 2
Most excellent. Thank you!
codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Designer...