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

  1. Click the control you want to change.

  2. On the View menu, click Properties Window.

  3. In the Properties window, double-click the location property to expand the node.

  4. 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

  1. On the Tools menu, click Options.

  2. 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:

To align two controls on a form

  1. Click the first control (this control becomes the reference), and then press the CTRL key and click the second control.

  2. 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

  1. Place the control on the form.

  2. Click the control so that the control's properties appear in the Properties window.

  3. In the Properties window, double-click the anchor property.

  4. In the Anchor editor, click the cross bars to enable and disable anchoring between the control and the form edge.

To modify docking behavior

  1. Place the control on the form.

  2. Click the control so that the control's properties appear in the Properties window.

  3. In the Properties window, double-click the dock property.

  4. 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.