ContentAlignment Énumération

Définition

Spécifie l'alignement du contenu de la surface de dessin.

public enum class ContentAlignment
public enum ContentAlignment
type ContentAlignment = 
Public Enum ContentAlignment
Héritage
ContentAlignment

Champs

BottomCenter 512

Le contenu est aligné verticalement en bas et horizontalement au centre.

BottomLeft 256

Le contenu est aligné verticalement en bas et horizontalement sur le côté gauche.

BottomRight 1024

Le contenu est aligné verticalement en bas et horizontalement sur le côté droit.

MiddleCenter 32

Le contenu est aligné verticalement au milieu et horizontalement au centre.

MiddleLeft 16

Le contenu est aligné verticalement au milieu et horizontalement sur le côté gauche.

MiddleRight 64

Le contenu est aligné verticalement au milieu et horizontalement sur le côté droit.

TopCenter 2

Le contenu est aligné verticalement en haut et horizontalement au centre.

TopLeft 1

Le contenu est aligné verticalement en haut et horizontalement sur le côté gauche.

TopRight 4

Le contenu est aligné verticalement en haut et horizontalement sur le côté droit.

Exemples

L’exemple de code suivant montre comment utiliser les constructeurs et Size l’énumération.Point.Point System.Drawing.ContentAlignment Pour exécuter cet exemple, collez ce code dans un formulaire Windows qui contient une étiquette nommée Label1 et appelez la méthode dans le InitializeLabel1 constructeur du formulaire.

void InitializeLabel1()
{
   // Set a border.
   Label1->BorderStyle = BorderStyle::FixedSingle;
   
   // Set the size, constructing a size from two integers.
   Label1->Size = System::Drawing::Size( 100, 50 );
   
   // Set the location, constructing a point from a 32-bit integer
   // (using hexadecimal).
   Label1->Location = Point(0x280028);
   
   // Set and align the text on the lower-right side of the label.
   Label1->TextAlign = ContentAlignment::BottomRight;
   Label1->Text = "Bottom Right Alignment";
}
private void InitializeLabel1()
{
    // Set a border.
    Label1.BorderStyle = BorderStyle.FixedSingle;

    // Set the size, constructing a size from two integers.
    Label1.Size = new Size(100, 50);

    // Set the location, constructing a point from a 32-bit integer
    // (using hexadecimal).
    Label1.Location = new Point(0x280028);

    // Set and align the text on the lower-right side of the label.
    Label1.TextAlign = ContentAlignment.BottomRight;
    Label1.Text = "Bottom Right Alignment";
}
Private Sub InitializeLabel1()

    ' Set a border.
    Label1.BorderStyle = BorderStyle.FixedSingle

    ' Set the size, constructing a size from two integers.
    Label1.Size = New Size(100, 50)

    ' Set the location, constructing a point from a 32-bit integer
    ' (using hexadecimal).
    Label1.Location = New Point(&H280028)

    ' Set and align the text on the lower-right side of the label.
    Label1.TextAlign = ContentAlignment.BottomRight
    Label1.Text = "Bottom Right Alignment"
End Sub

S’applique à