How can I stretch a user control?
I have a userControl it's highlighted in blue. Is's a TabControl.
开发者_运维问答How do I strech it to fill the entire parent.
And how to make ComboBox stretched if GroupBox changes
Update Please provide the code with this structure: - Window -> panel -> MyuserContorl - MyUserControl -> panel -> tabControl
To all stretched
You can anchor your user control by setting the Anchor
.
Here's a useful article
Edit:
In your user control
this.tabControl.Anchor = ((AnchorStyles)((((AnchorStyles.Top | AnchorStyles.Bottom)
| AnchorStyles.Left) | AnchorStyles.Right)));
You may also need to Dock
or Anchor
the panel inside your user control
.
In your window
this.userControl.Anchor = ((AnchorStyles)((((AnchorStyles.Top | AnchorStyles.Bottom)
| AnchorStyles.Left) | AnchorStyles.Right)));
Again you may need to Dock
or Anchor
the panel inside your form.
精彩评论