HorizontalAlignment 열거형
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
컨트롤의 개체 또는 텍스트가 컨트롤의 요소를 기준으로 가로로 정렬되는 방식을 지정합니다.
public enum class HorizontalAlignment
[System.Runtime.InteropServices.ComVisible(true)]
public enum HorizontalAlignment
[<System.Runtime.InteropServices.ComVisible(true)>]
type HorizontalAlignment =
Public Enum HorizontalAlignment
- 상속
- 특성
필드
| Name | 값 | Description |
|---|---|---|
| Left | 0 | 개체 또는 텍스트가 컨트롤 요소의 왼쪽에 맞춰집니다. |
| Right | 1 | 개체 또는 텍스트가 컨트롤 요소의 오른쪽에 맞춰집니다. |
| Center | 2 | 개체 또는 텍스트가 컨트롤 요소의 가운데에 맞춰집니다. |
예제
이 예제에서는 열거형을 HorizontalAlignment 사용하여 텍스트를 컨트롤 요소의 왼쪽, 오른쪽 또는 가운데에 맞추는 방법을 보여줍니다. 먼저 특정 크기로 TextBox 만든 다음 텍스트 문자열을 추가합니다. 그런 다음 열거형 멤버 Center 를 사용하여 텍스트를 가운데에 TextBox맞춥다. 이 예제에서는 명명된 이름과 이름을 만들었다고 Form 가정합니다TextBox.textBox1Form1
private:
void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
// Add a text String* to the TextBox.
textBox1->Text = "Hello World!";
// Set the size of the TextBox.
textBox1->AutoSize = false;
textBox1->Size = System::Drawing::Size( Width, Height / 3 );
// Align the text in the center of the control element.
textBox1->TextAlign = HorizontalAlignment::Center;
}
private void Form1_Load(object sender, System.EventArgs e)
{
// Add a text string to the TextBox.
textBox1.Text = "Hello World!";
// Set the size of the TextBox.
textBox1.AutoSize = false;
textBox1.Size = new Size(Width, Height/3);
// Align the text in the center of the control element.
textBox1.TextAlign = HorizontalAlignment.Center;
}
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Add a text string to the TextBox.
TextBox1.Text = "Hello World!"
' Set the size of the TextBox.
TextBox1.AutoSize = False
TextBox1.Size = New Size(Width, Height/3)
' Align the text in the center of the control element.
TextBox1.TextAlign = HorizontalAlignment.Center
End Sub
설명
이 열거형은 다양한 클래스에서 사용됩니다. 이러한 클래스CheckedListBox의 일부 목록은 , ,ColumnHeaderComboBox, ControlPaintLabel, ListBox, ControlRichTextBox및 .TextBox