ContentAlignment Enumerazione

Definizione

Specifica l'allineamento del contenuto sulla superficie di disegno.

public enum class ContentAlignment
public enum ContentAlignment
type ContentAlignment = 
Public Enum ContentAlignment
Ereditarietà
ContentAlignment

Campi

BottomCenter 512

Il contenuto è allineato verticalmente nella parte inferiore e orizzontalmente al centro.

BottomLeft 256

Il contenuto è allineato verticalmente nella parte inferiore e orizzontalmente a sinistra.

BottomRight 1024

Il contenuto è allineato verticalmente nella parte inferiore e orizzontalmente a destra.

MiddleCenter 32

Il contenuto è allineato verticalmente nella parte intermedia e orizzontalmente al centro.

MiddleLeft 16

Il contenuto è allineato verticalmente nella parte intermedia e orizzontalmente a sinistra.

MiddleRight 64

Il contenuto è allineato verticalmente nella parte intermedia e orizzontalmente a destra.

TopCenter 2

Il contenuto è allineato verticalmente nella parte superiore e orizzontalmente al centro.

TopLeft 1

Il contenuto è allineato verticalmente nella parte superiore e orizzontalmente a sinistra.

TopRight 4

Il contenuto è allineato verticalmente nella parte superiore e orizzontalmente a destra.

Esempio

Nell'esempio di codice seguente viene illustrato come usare i Point.Point costruttori e Size e l'enumerazione System.Drawing.ContentAlignment . Per eseguire questo esempio incollare questo codice in un modulo Windows contenente un'etichetta denominata Label1 e chiamare il InitializeLabel1 metodo nel costruttore del modulo.

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

Si applica a