Please see my advice given in my comment to the question. And follow it — there is no other way.
What you need will look something like this:
public class MyTextBox : System.Windows.Forms.TextBox {
public enum SizeBehaviorOption { Maximize, Minimize, Center, }
public SizeBehaviorOption SizeBehavior {
get { return this.sizeBehavior; }
set {
if (this.sizeBehavior == value) return;
this.sizeBehavior = value;
}
}
SizeBehaviorOption sizeBehavior;
}
Note the role of the
setter of the property. This is the main idea behind property: a setter (sometime getter, rarely) is used to add some side effect to read/write operation for the property values.
However, I suspect all this activity is redundant. You can usually implement desired behavior using docking containers, docking and padding properties, in some cases anchors. The further detail depend on UI library you want to use. Next time you ask a question, always tag this important detail.
—SA