ContentAlignment Énumération
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Spécifie l’alignement du contenu sur l’aire de dessin.
public enum class ContentAlignment
public enum ContentAlignment
type ContentAlignment =
Public Enum ContentAlignment
- Héritage
Champs
| Nom | Valeur | Description |
|---|---|---|
| TopLeft | 1 | Le contenu est aligné verticalement en haut et horizontalement aligné à gauche. |
| TopCenter | 2 | Le contenu est aligné verticalement en haut et aligné horizontalement au centre. |
| TopRight | 4 | Le contenu est aligné verticalement en haut et horizontalement aligné à droite. |
| MiddleLeft | 16 | Le contenu est aligné verticalement au milieu et aligné horizontalement à gauche. |
| MiddleCenter | 32 | Le contenu est aligné verticalement au milieu et aligné horizontalement au centre. |
| MiddleRight | 64 | Le contenu est aligné verticalement au milieu et aligné horizontalement à droite. |
| BottomLeft | 256 | Le contenu est aligné verticalement au bas et aligné horizontalement à gauche. |
| BottomCenter | 512 | Le contenu est aligné verticalement au bas et aligné horizontalement au centre. |
| BottomRight | 1024 | Le contenu est aligné verticalement au bas et aligné horizontalement à droite. |
Exemples
L’exemple de code suivant montre comment utiliser les Point.Point constructeurs et Size l’énumération 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 InitializeLabel1 dans le 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