How to change "area" of a control in DesignMode?
- by Tronex
When I drag and drop a TextBox from the toolbox onto a WinForm, I can drag it around on the form as I like.
Now I create a new class and inherit it from TextBox. I add a new property called CaptionLabel. When set to a value, I dynamically create a Label control, set its value and finally add the label to the TextBox' parent controlcollection.
The result is a "LabeledTextBox".
However, when selecting the TextBox, I still only get the TextBox selected... the selection rectangle does not include the Label, created dynamically.
How do I extend the rectangle so that it also contains the Label and make the label "know" that it belongs to the TextBox?
Or is there a better way to create labeled controls?