HorizontalAlignment Sabit listesi

Tanım

Denetimdeki bir nesnenin veya metnin, denetimin bir öğesine göre nasıl yatay olarak hizalı olduğunu belirtir.

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
Devralma
HorizontalAlignment
Öznitelikler

Alanlar

Center 2

Nesne veya metin, denetim öğesinin ortasına hizalanır.

Left 0

Nesne veya metin, denetim öğesinin soluna hizalanır.

Right 1

Nesne veya metin, denetim öğesinin sağ tarafında hizalanır.

Örnekler

Bu örnekte, metni bir denetim öğesinin soluna HorizontalAlignment , sağa veya ortasına hizalamak için numaralandırmanın nasıl kullanılacağı gösterilmektedir. İlk olarak, belirli bir boyuta sahip bir TextBox oluşturun ve buna bir metin dizesi ekleyin. Ardından, numaralandırma üyesini Center kullanarak metni öğesinin ortasına hizalayın TextBox. Örnekte, adlandırılmış ve adlandırılmış textBox1``Form1 bir Form TextBox oluşturduğunuz varsayılır.

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

Açıklamalar

Bu numaralandırma çok sayıda sınıfta kullanılır. Bu sınıfların kısmi listesi , ColumnHeader, , ComboBox, ControlPaint, Label, ListBox, ControlRichTextBoxve TextBoxşeklindedirCheckedListBox.

Şunlara uygulanır