|
Format Menu in VS .NET
The Format Menu available in Visual Studio .NET IDE allows us to align, layer and
lock controls on a form. The Format menu provides many options for arranging controls.
The Format Menu is shown in the image below.
When using Format menu for arranging controls, we need to select the controls in such
a way that the last control selected is the primary control to which other controls
are aligned. The primary control has dark size handles and all other controls have
light size handles.
The different options that are available under the Format menu are listed below.
Align: Aligns all controls with respect to the primary control
Make Same Size: Resizes multiple controls on a form
Horizontal Spacing: Increases horizontal spacing between controls
Vertical Spacing: Increases vertical spacing between controls
Center in Form: Centers the controls on form
Order: Layers controls on form
Lock Controls: Locks all controls on form
Aligning multiple controls on a Form
Let's work with an example. Open a new form and drag some controls onto it from the
toolbox. Select the controls you want to align. The last control you select is
the primary control to which all other controls align. On the Format menu point
to align and then click any of the seven options available. The image below displays
the controls after selection. From the image notice the CheckBox control with dark
handles. That's the primary control.
The image below displays controls that are aligned after selecting the option Lefts
under Align from the Format menu. All the controls are left-aligned.
Make Same Size
The Make Same Size option under Format menu provides four options using which we can
make all the controls same in size, width or height. The image below displays controls
with the option width that makes all the controls same in width as the primary control.
Locking Controls
To lock all controls so that they cannot be moved accidentally, select Format menu
and click lock controls. The image below displays that.
|