ContentAlignment Enum
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Anger justering av innehåll på ritytan.
public enum class ContentAlignment
public enum ContentAlignment
type ContentAlignment =
Public Enum ContentAlignment
- Arv
Fält
| Name | Värde | Description |
|---|---|---|
| TopLeft | 1 | Innehållet är lodrätt justerat överst och vågrätt justerat till vänster. |
| TopCenter | 2 | Innehållet är lodrätt justerat överst och vågrätt justerat i mitten. |
| TopRight | 4 | Innehållet är lodrätt justerat överst och vågrätt justerat till höger. |
| MiddleLeft | 16 | Innehållet är lodrätt justerat i mitten och vågrätt justerat till vänster. |
| MiddleCenter | 32 | Innehållet är lodrätt justerat i mitten och vågrätt justerat i mitten. |
| MiddleRight | 64 | Innehållet är lodrätt justerat i mitten och vågrätt justerat till höger. |
| BottomLeft | 256 | Innehållet är lodrätt justerat längst ned och vågrätt justerat till vänster. |
| BottomCenter | 512 | Innehållet är lodrätt justerat längst ned och vågrätt justerat i mitten. |
| BottomRight | 1024 | Innehållet är lodrätt justerat längst ned och vågrätt justerat till höger. |
Exempel
Följande kodexempel visar hur du använder Point.Point konstruktorerna och System.Drawing.ContentAlignmentSize uppräkningen. Om du vill köra det här exemplet klistrar du in den här koden i ett Windows formulär som innehåller en etikett med namnet Label1 och anropar metoden InitializeLabel1 i formulärets konstruktor.
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