HorizontalAlignment 열거형

정의

컨트롤의 개체 또는 텍스트가 해당 컨트롤의 요소에 대해 상대적으로 수평으로 맞추는 방법을 지정합니다.

public enum class HorizontalAlignment
[System.Runtime.InteropServices.ComVisible(true)]
public enum HorizontalAlignment
public enum HorizontalAlignment
[<System.Runtime.InteropServices.ComVisible(true)>]
type HorizontalAlignment = 
type HorizontalAlignment = 
Public Enum HorizontalAlignment
상속
HorizontalAlignment
특성

필드

Center 2

개체 또는 텍스트가 컨트롤 요소의 가운데에 맞춰집니다.

Left 0

개체 또는 텍스트가 컨트롤 요소의 왼쪽에 맞춰집니다.

Right 1

개체 또는 텍스트가 컨트롤 요소의 오른쪽에 맞춰집니다.

예제

이 예제에서는 열거형을 HorizontalAlignment 사용하여 텍스트를 컨트롤 요소의 왼쪽, 오른쪽 또는 가운데에 맞추는 방법을 보여줍니다. 먼저 특정 크기로 TextBox 만든 다음 텍스트 문자열을 추가합니다. 그런 다음 열거형 멤버 Center 를 사용하여 텍스트를 가운데에 TextBox맞춥다. 이 예제에서는 명명된 이름과 이름을 textBox1``Form1 만들었다고 Form 가정합니다TextBox.

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

적용 대상