JavaScript Editor js editor     Web development 



Main Page

Specifies the alignment for text in a control. Available at design time and run time.

Control.Alignment[ = nAlign]

Return Value

CheckBox, OptionButton, and CommandButton Controls

nAlign


Specifies a numerical value representing the alignment of text in a control.

nAlign Description

0

Vertically Centered Left. (Default for check boxes and option buttons) Aligns text flush left and vertically centered on the control.

1

Vertically Centered Right. (Default for Middle Eastern versions of Windows) Aligns text flush right and vertically centered on the control.

2

Centered. (Default for command buttons) Centers text vertically and horizontally.

Note:
For command buttons, the image and text appear in the center of the control. However, when an image is specified for the Picture property, this setting displays the default behavior only when the PictureMargin and PictureSpacing properties are set to 0.

Note:
For check boxes and option buttons, this setting applies only when the control's Style property is set to 1. Setting the Style property affects the appearance of the control. For more information, see Style Property.

4

Top Left. Aligns text in top left corner of the control.

Note:
For check boxes and option buttons, this setting applies only when the control's Style property is set to 1. Setting the Style property affects the appearance of the control. For more information, see Style Property.

5

Top Right. Aligns text in top right corner of the control.

Note:
For check boxes and option buttons, this setting applies only when the control's Style property is set to 1. Setting the Style property affects the appearance of the control. For more information, see Style Property.

6

Top Center. Aligns text at the top and horizontally centered on the control.

Note:
This setting applies only when the control's Style property is set to 1. Setting the Style property affects the appearance of the control. For more information, see Style Property.

7

Bottom Left. Aligns text in the bottom left corner of the control.

Note:
For check boxes and option buttons, this setting applies only when the control's Style property is set to 1. Setting the Style property affects the appearance of the control. For more information, see Style Property.

8

Bottom Right. Aligns text in bottom right corner of the control.

Note:
For check boxes and option buttons, this setting applies only when the control's Style property is set to 1. Setting the Style property affects the appearance of the control. For more information, see Style Property.

9

Bottom Center. Aligns text at the bottom and vertically centered on the control.

Note:
For check boxes and option buttons, this setting applies only when the control's Style property is set to 1. Setting the Style property affects the appearance of the control. For more information, see Style Property.

Note:
For CommandButton controls, you can set the Alignment property without specifying an image for the Picture property. However, certain Alignment settings are visible only when you specify an image for the Picture property and set the PicturePosition property to a value other than the default. In addition, some Alignment settings are not visible unless the WordWrap property is set to True (.T.) and Caption text displays on multiple lines. When you do not specify an image for the Picture property, the PicturePosition setting does not affect the Alignment property.

Note:
For CheckBox and OptionButton controls, when Style is set to 0, the PicturePosition property affects the position of the check boxes or option buttons in the control. When you specify an image for the Picture property, the PicturePosition property can affect the Alignment property. For example, the default setting for PicturePosition results in a centered alignment regardless of the setting for Alignment. For more information, see Picture Property (Visual FoxPro) and PicturePosition Property.

ComboBox, EditBox, Label, and Spinner Controls

nAlign


Specifies a numerical value representing the alignment of text in a control.

nAlign Description

0

Left. Aligns text flush left. (Default for combo boxes, edit boxes, and labels)

1

Right. Aligns text flush right. (Default for spinners and for Middle Eastern versions of Windows)

2

Center. Centers text vertically and horizontally on the control.

3

Automatic. Aligns text based on the data type of the control source.

Note:
The Automatic setting does not apply to EditBox, Header, or Label controls.

Note:
For ComboBox controls, the Alignment property applies only when the Style property is set to 0.

Header and Column Objects

nAlign


Specifies a numerical value representing the alignment of text in a control.

nAlign Description

0

Vertically Centered Left. Aligns text flush left and centers it vertically in the column.

1

Vertically Centered Right. Aligns the text flush right and centers it vertically in the column.

2

Centered. Centers the text vertically and horizontally.

3

Automatic. Aligns text in the column based on the data type of the control source. (Default)

Note:
The Automatic setting aligns text based on the data type of the control source, specified by the ControlSource property. For control sources with numeric types, such as Numeric, Double, Float, Currency, and Integer, text is aligned to the right. For control sources with other data types, text is aligned to the left.

4

Top Left. Aligns the text flush left at the top of the column.

5

Top Right. Aligns the text flush right at the top of the column.

6

Top Center. Aligns the text at the top and horizontally centered in the column.

7

Bottom Left. Aligns the text flush left at the bottom of the column.

8

Bottom Right. Aligns the text flush right at the bottom of the column.

9

Bottom Center. Aligns the text at the bottom and horizontally centered in the column.

For a Header object, if the WordWrap property is set to False (.F.), values 0-2, 4-9 are available. If the WordWrap property is set to True (.T.), values 0-2 are effective.

TextBox Control

nAlign


Specifies a numerical value representing the alignment of text in Textbox control.

nAlign Description

0

Left. Aligns text flush left.

1

Right. Aligns text flush right.

2

Center. Aligns text in the horizontally and vertically centered on the control.

3

Automatic. (Default)

Note:
For a TextBox control not contained in a column, the Automatic setting aligns text based on the data type of the control source, specified by the ControlSource property. For control sources with numeric types, such as Numeric, Double, Float, Currency, and Integer, text is aligned to the right. For control sources with other data types, text is aligned to the left. For more information, see ControlSource Property.

Note:
For a TextBox control in a column, the column's Alignment setting determines alignment of text in the text box.

Remarks

See Also



JavaScript Editor js editor     Web development