Jankya
Jankya

Reputation: 958

Resize Controls When Form Resize

I just wondering about my windows Application. When i re-size windows form that time my Form controls should re-size. Can any body tell me how to do this I have Used Anchor property for that but no luck.

This is a win form.

Upvotes: 2

Views: 25661

Answers (3)

2pietjuh2
2pietjuh2

Reputation: 879

If you set the Dock property of your control to Fill. You could also take a look at the tableLayoutPanel if you have more controls which you want to keep aligned while resizing your form.

Upvotes: 1

KF2
KF2

Reputation: 10171

there are two ways to make a control automatically resize based on size changes of the :

  1. Set the Dock property of the control to DockStyle.Fill.
  2. Set the Anchor property to "Top, Bottom, Left, Right"

But if you decide to use WPF GridLayout,it has a lot Capability for this target.

Edited

See this short tutorial Resizing controls with form: Anchor property Tutorial

Upvotes: 5

Praveen VR
Praveen VR

Reputation: 1564

You have to use the anchor property in properly. For example, for DataGridview to resize in its all direction, you have to set its anchor property as Top, Bottom, Left, Right

You have to set the anchor property suitably for each controls in the form as per your requirement.

Hope this helps.

Upvotes: 4

Related Questions