This issue is concerning C# WinForms ... I have custom user control which basically has 3 things: A label, a text box, and a list box, all arranged vertically like this:
I have written a small Custom ControlDesigner class to prevent the user from changing the height of this user control at design time.
I also have set the textbox and listbox to anchor to left/right locations, so that when the user changes the width of the user control, these two internal controls resize beautifully.
I want to have the Label is the horizontal center as well, but anchoring that to left/right doesn't seem to work. I'm thinking I might have to written some sort of custom resize function inside the custom control designer class, which automatically places the label in the middle when the user control is resized ?
Also note that I want to label to still remain in the center when the label text is changed.
So how do I do this ?
Here is my custom control designer class till now:
public class DropDownTextBoxDesigner : System.Windows.Forms.Design.ControlDesigner
{
public override SelectionRules SelectionRules
{
get
{
SelectionRules retVal =
SelectionRules.Visible |
SelectionRules.Moveable |
SelectionRules.LeftSizeable |
SelectionRules.RightSizeable;
return retVal;
}
}
}