Formatting Forms
You can format objects you have placed on your form using the location properties for the form, the grid options on the Tools menu, and various options on the Format menu.
To change a control’s location properties
-
Click the control you want to change.
-
On the View menu, click Properties Window.
-
In the Properties window, double-click the location property to expand the node.
-
Enter the x and y coordinate properties for your control.
Note You can also change the location programmatically by setting the x and y location properties.
To set grid options
-
On the Tools menu, click Options.
-
In the Options dialog box tree-view area of your project, double-click Forms Designers, and then click WFC.
You can use this dialog box to set the defaults for displaying the grid, the grid height and width in pixels, and to toggle alignment to the grid.
To format controls on a form, you can use the options on the Format menu to:
-
Align controls.
-
Make multiple controls the same size.
-
Size to grid.
-
Adjust horizontal and vertical spacing.
-
Adjust the front-to-back order.
-
Lock controls in place.
To align two controls on a form
-
Click the first control (this control becomes the reference), and then press the CTRL key and click the second control.
-
On the Format menu, point to Align, and then click Lefts.
The second control aligns with the left edge of the first control.
Note Controls can be stacked on top of each other.
Modifying the Form Layout Behavior
With the Forms Designer, you can define the behaviors of controls that are placed on your form. For example, you can anchor a label control at the top of the form using the anchor property, or you can modify the docking behavior of your form.
To anchor the control within the form
-
Place the control on the form.
-
Click the control so that the control's properties appear in the Properties window.
-
In the Properties window, double-click the anchor property.
-
In the Anchor editor, click the cross bars to enable and disable anchoring between the control and the form edge.
To modify docking behavior
-
Place the control on the form.
-
Click the control so that the control's properties appear in the Properties window.
-
In the Properties window, double-click the dock property.
-
In the Docking editor, click the bars to enable and disable docking for the control. Click None to disable docking.
Note The control is automatically resized to fit the boundaries of the docked edge.
Most controls can be docked to the edges of a form or can be made to fill the entire form.