I have a User Control
that contains a number of other controls. I want my User Control to resize itself properly as the user resizes the parent form.
I have set the AutoSize
property of this User Control to true
.
Even though I have set the Anchor
property of all the controls inside my User Control, it is the User Control itself that
InitializeComponent()
method (Visual Studio automatically removes the line from the Designer code and from then my User Control gets dragged to the bottom right of the designer) How can I set my User Control so that it gets resized as the user changes the size of the form?
The Dock
and Anchor
properties are hidden from the designer of the UserControl
. They are only availbly once an instance has been added to some parent.
However they do exist and can be set, for example in the constructor:
this.Dock = DockStyle.Fill;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.