Aracılığıyla paylaş


Alignment Property

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]
    > <P>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 <A href="yx632967(v=vs.90).md">Style Property</A>.</P>
    

    5

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

    > [!NOTE]
    > <P>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 <A href="yx632967(v=vs.90).md">Style Property</A>.</P>
    

    6

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

    > [!NOTE]
    > <P>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 <A href="yx632967(v=vs.90).md">Style Property</A>.</P>
    

    7

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

    > [!NOTE]
    > <P>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 <A href="yx632967(v=vs.90).md">Style Property</A>.</P>
    

    8

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

    > [!NOTE]
    > <P>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 <A href="yx632967(v=vs.90).md">Style Property</A>.</P>
    

    9

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

    > [!NOTE]
    > <P>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 <A href="yx632967(v=vs.90).md">Style Property</A>.</P>
    
    > [!NOTE]
    > <P>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.</P>
    
    
    
    > [!NOTE]
    > <P>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 <A href="z2w1t495(v=vs.90).md">Picture Property (Visual FoxPro)</A> and <A href="b5hx1tx6(v=vs.90).md">PicturePosition Property</A>.</P>
    

    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]
      > <P>For ComboBox controls, the Alignment property applies only when the Style property is set to 0.</P>
      

      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