Whether you create a new control from scratch or inherit from another one, you need to add variables that will hold the property value, and properties which will work as methods would.
Let's say your control will have property ControlSize, not determined by a number, but a choice out of 3, example "Small", "Medium", "Big".
You could allow the user to pick from numbers 1, 2, 3 and make it an int property, but let's better use an enumeration (for ellegance).
Add:
enum Sizes {Small, Medium, Big}
And then a variable of this type, but make sure to make it private:
private Sizes controlsize;
Then the property, which is in fact the one the developers will see (therefore, this one goes public):
public Sizes ControlSize
{
get { return controlsize; }
set
{
controlsize = value;
if (controlsize = Sizes.Small)
this.Size = new Size(10, 10);
else if (controlsize = Sizes.Medium)
this.Size = new Size(20, 20);
else if (controlsize = Sizes.Big)
this.Size = new Size(30, 30);
}
}
The property will cause both to change the property value as well as the actual size.
Hope this helps!
PS "Size" will only exist from the System.Drawing library, so you'll need
using System.Drawing; in the header.