HorizontalAlignment 列挙体とは? わかりやすく解説

HorizontalAlignment 列挙体

コントロールオブジェクトまたはテキストコントロール要素合わせて平方向に配置する場合どのように配置するのかを指定します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

<ComVisibleAttribute(True)> _
Public Enumeration HorizontalAlignment
Dim instance As HorizontalAlignment
[ComVisibleAttribute(true)] 
public enum HorizontalAlignment
[ComVisibleAttribute(true)] 
public enum class HorizontalAlignment
/** @attribute ComVisibleAttribute(true) */ 
public enum HorizontalAlignment
ComVisibleAttribute(true) 
public enum HorizontalAlignment
メンバメンバ
解説解説

この列挙体は、さまざまなクラス使用されます。これらに含まれるクラス部分リストは CheckedListBox、ColumnHeader、ComboBox、ControlPaint、LabelListBoxControl、RichTextBox、TextBox などです。

使用例使用例

この例では、HorizontalAlignment 列挙体を使用してテキストコントロール要素の左、右、または中央配置する方法示してます。最初に特定のサイズTextBox作成して文字列追加します次に、この列挙体のメンバ Center使用してテキストTextBox中央配置します。この例は、Form1 という名前の FormtextBox1 という名前の TextBox作成済みであることを前提にしています。

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
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:
   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.set_Text("Hello World!");

    // Set the size of the TextBox.
    textBox1.set_AutoSize(false);
    textBox1.set_Size(new Size(get_Width(), get_Height() / 3));

    // Align the text in the center of the control element. 
    textBox1.set_TextAlign(HorizontalAlignment.Center);
} //Form1_Load
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「HorizontalAlignment 列挙体」の関連用語

HorizontalAlignment 列挙体のお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



HorizontalAlignment 列挙体のページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS