Language

TextBox.Multiline プロパティ

定義

複数行の TextBox コントロールであるかどうかを示す値を取得または設定します。

public:
 virtual property bool Multiline { bool get(); void set(bool value); };
public override bool Multiline { get; set; }
member this.Multiline : bool with get, set
Public Overrides Property Multiline As Boolean

プロパティ値

true コントロールが複数行の TextBox コントロールの場合は。それ以外の場合は false。 既定値は false です。

例

次のコード例では、垂直スクロール バーを含む複数行 TextBox コントロールを作成します。 次の使用例は、 AcceptsTab、 AcceptsReturn、および WordWrap プロパティを使用して、テキスト ドキュメントの作成に役立つ複数行テキスト ボックス コントロールを作成します。

public:
   void CreateMyMultilineTextBox()
   {
      // Create an instance of a TextBox control.
      TextBox^ textBox1 = gcnew TextBox;
      
      // Set the Multiline property to true.
      textBox1->Multiline = true;
      // Add vertical scroll bars to the TextBox control.
      textBox1->ScrollBars = ScrollBars::Vertical;
      // Allow the RETURN key to be entered in the TextBox control.
      textBox1->AcceptsReturn = true;
      // Allow the TAB key to be entered in the TextBox control.
      textBox1->AcceptsTab = true;
      // Set WordWrap to true to allow text to wrap to the next line.
      textBox1->WordWrap = true;
      // Set the default text of the control.
      textBox1->Text = "Welcome!";
   }
public void CreateMyMultilineTextBox()
 {
    // Create an instance of a TextBox control.
    TextBox textBox1 = new TextBox();
       
    // Set the Multiline property to true.
    textBox1.Multiline = true;
    // Add vertical scroll bars to the TextBox control.
    textBox1.ScrollBars = ScrollBars.Vertical;
    // Allow the RETURN key to be entered in the TextBox control.
    textBox1.AcceptsReturn = true;
    // Allow the TAB key to be entered in the TextBox control.
    textBox1.AcceptsTab = true;
    // Set WordWrap to true to allow text to wrap to the next line.
    textBox1.WordWrap = true;
    // Set the default text of the control.
    textBox1.Text = "Welcome!";
 }
Public Sub CreateMyMultilineTextBox()
    ' Create an instance of a TextBox control.
    Dim textBox1 As New TextBox()
    
    ' Set the Multiline property to true.
    textBox1.Multiline = True
    ' Add vertical scroll bars to the TextBox control.
    textBox1.ScrollBars = ScrollBars.Vertical
    ' Allow the RETURN key to be entered in the TextBox control.
    textBox1.AcceptsReturn = True
    ' Allow the TAB key to be entered in the TextBox control.
    textBox1.AcceptsTab = True
    ' Set WordWrap to true to allow text to wrap to the next line.
    textBox1.WordWrap = True
    ' Set the default text of the control.
    textBox1.Text = "Welcome!"
End Sub

注釈

AutoCompleteSource は、複数行の TextBox コントロールでは機能しません。

フォントが変更されると、定義したインデントは表示されません。 インデントを取得するには、 Multiline を true に設定し、SETMARGINS が呼び出されないように基底クラスを呼び出さずにWM_SETFONTをオーバーライドします。

適用対象