You can use the LabelX and LabelY properties to change the placement of labels attached to new controls. For example, you might want an attached label to appear to the right of a control instead of to the left.
Setting
Enter a positive or negative number that specifies the distance of label text from the upper-left corner of the label's attached control. To use a unit of measurement different from the setting in the Regional Settings Properties dialog box in Windows Control Panel, specify the unit, such as cm or in (for example, 2 cm or 1.5 in).
You can set these properties only by using a control's default control style or the DefaultControl method in Visual Basic.
Remarks
The LabelX property sets the distance on the horizontal axis and the LabelY property sets the distance on the vertical axis. A negative number for the LabelX property places the label's upper-left corner to the left of the control. A negative number for the LabelY property places the label's upper-left corner above the control. Positive numbers for both properties place the label to the right of and below the upper-left corner of the control.
If the LabelAlign property is set to Right or Left, the LabelX and LabelY properties specify the distance between the right or left edge of the label and the control's upper-left corner. If the LabelAlign property is set to Center, the LabelX and LabelY properties specify the distance between the center of the label and the control's upper-left corner.
Combining the LabelX, LabelY, and LabelAlign properties produces the following results.
LabelX | LabelY | LabelAlign | Result |
---|---|---|---|
–1 in | 0 in | General | The label's upper-left corner is 1 inch to the left of the control's upper-left corner. |
–.5 in | 0 in | Right | The label's upper-right corner is 0.5 inch to the left of the control's upper-left corner. |
.5 in | –.5 in | Center | The center of the top of the label is 0.5 inch to the right and 0.5 inch above the control's upper-left corner. |