I am trying to create a multilayout main screen application. I have some buttons at the top that link to the main section of the application (e.g. management window for each entity in the Model)
Clicking any of these button displays the associated UserControl in a Panel. The Panel holds the UserControls that in turn holds the UI.
The WinForms UserControl does not have the Anchor
or Dock
property.
I have tried setting property of UserControl
AutoSize=True
And
private void ManageUsersControl_Load(object sender, EventArgs e) { this.Width = this.Parent.Width; this.Height = this.Parent.Height; }
But these did not work.
Note: I load this control dynamically at runtime
Right click on your form and go to properties. Then go to Layout options,see there are a property named Size. Change it as your need as width and length wise.
To make a control resize with the form, set the Anchor to all four sides, or set Dock to Fill . It's fairly intuitive once you start using it. For example, if you have OK/Cancel buttons in the lower right of your dialog, set the Anchor property to Bottom and Right to have them drag properly on the form.
There's an AutoSize option in the Properties windows; if you turn that off by changing it to False , you will be able to modify the size of your CheckBox .
A UserControl is a collection of controls placed together to be used in a certain way. For example you can place a GroupBox that contains Textbox's, Checkboxes, etc. This is useful when you have to place the same group of controls on/in multiple forms or tabs.
Try setting the Dock
property to Fill
:
private void ManageUsersControl_Load(object sender, EventArgs e) { this.Dock = DockStyle.Fill; }
I would also set AutoSize
to the default, I believe is False
. See how that works ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With