Sizing objects

You can change the dimensions of objects on the Design Canvas in any of the following ways:

Note: Certain controls have inherent constraints that prevent one or both of their dimensions from being changed (for example, you cannot change the height of a combo box control; a toolbar button cannot be resized). If you specify a new value for a protected dimension, the change is ignored.

Sizing objects by dragging

To size objects by dragging, select one or more objects that you want to operate on. Click on a selection handle on one of the objects and hold down the primary mouse button while you drag that object to the desired shape. Changes to the dimensions of the dragged object are applied in equal increments to all selected objects.

Once you have sized controls the way you want them, you can lock them to protect against their being resized by dragging. To do so, right-click on the Design Canvas and select Lock Controls. A locked control shows a small padlock icon at its top left corner when selected. This option does not prevent resizing by setting values in the Properties grid, nor does it apply to controls that you add after you invoke the locking option. To turn off the option, select Lock Controls from the context menu again.

Changing dimensions by increments of one pixel

To increase or decrease width or height by increments of a single pixel, select one or more objects that you want to operate on. Hold down Shift and press an arrow key as follows:

Sizing objects by setting property values

To size objects explicitly to precise dimensions, select one or more objects that you want to operate on. In the Properties view, click the Properties tab and find the Size property in the grid.

Sizing objects by duplicating dimensions

Use this technique when you want to make one or more objects the same size (height, width, or both) as another existing object. Select the base object, that is, the object whose dimension(s) you want to duplicate, select the target objects to which you want to apply the dimension(s) of the base object. Select Design > Size. From the sub-menu, select Width, Height, or Both to apply one or both dimensions of the base object to the target objects.

Sizing objects to grid dimensions

The Design Canvas has an underlying grid (not visible on the form at run time) that is available to help you size and position objects. You can set various options related to use of the grid on the Visual Designer Preferences page. These options include the horizontal and vertical spacing of the grid lines.

The Size To Grid option is a quick way to adjust the size of selected objects so that their dimensions are multiples of the specified grid spacing values. The adjustment either enlarges or shrinks each object to the nearest exact multiple. For example, suppose you are using the default grid spacing of eight pixels for both horizontal and vertical dimensions. If you apply the Size To Grid command to a control that measures 17 pixels wide by 23 pixels high, the control is resized to 16 pixels wide by 24 pixels high (the nearest exact multiples of 8 to 17 and 23, respectively).

To use this command, select the controls to be resized and then select Design > Size > Size To Grid. Note that this command also snaps the objects to the nearest grid lines.