Changes

Jump to: navigation, search

Designing Forms in Visual Studio

2,368 bytes added, 18:06, 20 July 2007
Positioning Controls Using Snap Lines
<tr><td>[[Image:visual_studio_snap_lines.jpg]]<td>[[Image:visual_studio_snap_lines_right.jpg]]</td>
</table>
 
== Selecting Multiple Controls ==
 
It is often useful to be able to select multiple controls in a form. Normally when you click on one control in a form, the currently selected control is deselected. There are two ways to select multiple controls. One method is to hold down the ''Shift'' key while selecting controls. With the ''Shift'' key pressed any currently selected controls will remain selected while other controls are clicked.
 
Another method is to ''rubber band'' the controls. To do this click on any empty area fo teh form to the top left of the group of controls you wish to select. With the mouse button depressed drag to draw a box around the controls. When you release the mouse button all the controls within the box area will be selected.
 
To deselect individual controls from a group of selected controls, simply hold down the ''Shift'' key and click with the left hand mouse button on the control to deselect.
 
Once a group of controls are selected you can move all the controls at once, maintaining their positions relative to each other, simply by clicking and dragging the entire group.
 
Now that we have covered selecting groups of controls we can now look at some other tasks that can be performed on groups in Visual Studio.
 
== Aligning and Sizing Groups of Controls ==
 
Visual Studio provides a number of tools to assist in aligning groups and sizing groups of controls in a form. These features are accessed using the layout toolbar. To display the layout toolbar right click on any part of the standard Visual Studio Toolbar and select ''Layout'' from the drop down menu. The resulting toolbar will appear as follows:
 
[[Image:Exampl.jpg]]
 
Select a group of components and click on the various buttons in the toolbar to see the effect. For example, all the controls can be left or right aligned and resized to the same size, width or height. It is also possible to equally space the controls, and then increase or decrease the spacing used to separate the controls. It is also possible pace controls on top of one another and change which control appears on top of the stack (this can also be done in Visual Basic code using the BringToFront() and ''SendToBack()'' methods of the respective controls).
 
All together, the selection of controls allow just about any uniform layout to be achieved from a group of controls in a form.
 
==

Navigation menu