Mediator
Mediator

Reputation: 15378

How to fill a user control?

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.

enter image description here

And how to make ComboBox stretched if GroupBox changesenter image description here

Update Please provide the code with this structure: - Window -> panel -> MyuserContorl - MyUserControl -> panel -> tabControl

To all stretched

Upvotes: 0

Views: 912

Answers (1)

Eranga
Eranga

Reputation: 32447

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.

Upvotes: 2

Related Questions