Formatting Forms

   

Objects placed on a form can be aligned and grouped using the location properties for the form, the grid options from the Tools menu, and from the Format menu.

To set grid options

  1. On the Tools menu, click Options.

    The Options dialog box appears.

  2. In the Options dialog box tree-view area of your project, double-click Forms, and then select WFC. The forms Options page for the Toolbox window appears.

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 change location properties

  1. Select the control you wish to change

  2. On the View menu, click Properties window.

    The Properties window opens.

  3. In the Properties window, double-click the Location property to expand the node. You can enter the x and y coordinate properties for your control. You can also change the location programmatically by setting the x and y location properties.

To format controls on a form, you can use the options on the Format menu to manage your controls. You can:

To align two controls on a form

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

  2. On the Format menu, click Align and select Lefts from the cascading menu.

    The second control aligns with the left edge of the first control.

    Note that controls can be stacked on top of each other.

Modifying the Form Layout Behavior

With the Form 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.

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. Double-click the Anchor property in the Properties window.

    The Anchor position editor appears.

  4. Click on the cross bars in the editor to enable and disable anchoring behavior 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. Double-click the Dock property in the Properties window.

    The Dock editor appears.

  4. Click on the bars in the editor to enable and disable docking behavior for the control. Click None to disable the docking behavior.

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.