Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 515
Bender the Greatest Avatar asked Aug 22 '13 15:08

Bender the Greatest


People also ask

Is it possible to resize a control within the form design window?

You can resize individual controls, and you can resize multiple controls of the same or different kind, such as Button and GroupBox controls.

Which property is used to resize the control with form?

The Anchor Property determines how a control is automatically resized when its parent control is resized. It defines the position for the control on the form. When designing a form that can be resized at run-time, the controls on the form should resize and reposition accordingly.

What is docking anchoring?

Anchor refers to the position a control has relative to the edges of the form. A textbox, for example, that is anchored to the left edge of a form will stay in the same position as the form is resized. Docking refers to how much space you want the control to take up on the form.

What does anchoring mean in access?

By default, the controls on an Access form stay anchored to the upper-left corner of the form, and do not resize when you resize the form. To change this behavior, you can use the Anchoring command. For example, you can configure a text box so that it stretches down and to the right as the form becomes larger.


1 Answers

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.

like image 181
Hans Passant Avatar answered Nov 15 '22 18:11

Hans Passant