codewario
codewario

Reputation: 21408

Stop anchored controls from moving when resizing the form in the designer

Is there a way to resize a form in the designer without moving any anchored controls? I am using winforms in Visual Studio 2010.

Upvotes: 11

Views: 3433

Answers (2)

Hans Passant
Hans Passant

Reputation: 941277

You have to know when it is okay to cheat. Open the form's Designer.cs file and edit the this.ClientSize property assignment. That changes the form size but doesn't affect the Location of controls anchored to the right or bottom.

Upvotes: 22

r.net
r.net

Reputation: 631

You can try this ... keep all the controls to default (i.e. Top, Left) as you are in design view and then anchor them in the code in the form_load / activate event.

Upvotes: 1

Related Questions