TextBoxBase.Multiline プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Dim instance As TextBoxBase Dim value As Boolean value = instance.Multiline instance.Multiline = value
[LocalizableAttribute(true)] public: virtual property bool Multiline { bool get (); void set (bool value); }
/** @property */ public boolean get_Multiline () /** @property */ public void set_Multiline (boolean value)
コントロールが複数行テキスト ボックス コントロールである場合は true。それ以外の場合は false。既定値は false です。

複数行テキスト ボックスでは、コントロールに複数行のテキストを表示できます。WordWrap プロパティが true に設定されている場合、複数行テキスト ボックスに入力されたテキストは、コントロール内の次の行に折り返されます。WordWrap プロパティが false に設定されている場合、複数行テキスト ボックス コントロールに入力されたテキストは、改行が行われるまで同じ行に表示されます。
-
Environment.NewLine
-
ControlChars.CrLf
-
vbCrLf (Visual Basic のみ)
ScrollBars プロパティを使用すると、テキスト ボックスにスクロール バーを追加したり、水平スクロール バーまたは垂直スクロール バー (あるいはその両方) を表示したりできます。ユーザーはスクロール バーを使用してコントロールに収まらないテキストをスクロールできます。
![]() |
---|
Multiline プロパティの既定値は false であるため、TextBox のサイズを変更した場合でも、TextBox の既定のサイズは、フォントのサイズに合わせて決定されます。TextBox のサイズを一定にするには、Multiline プロパティを true に設定します。 |
![]() |
---|
日本語のオペレーティング システムでは、Multiline プロパティを true に設定すると、PasswordChar プロパティを設定した場合にパスワードのテキストが表示されるため、システム セキュリティが低下します。このため、日本語のオペレーティング システムで PasswordChar プロパティを設定する場合は、Multiline プロパティを false に設定します。 |
RichTextBox コントロールでは、RichTextBox.Multiline プロパティによって、コントロールが自動的にサイズ変更されるかどうかが次のように決定されます。

派生クラス TextBox を使用して、垂直スクロール バーのある複数行 TextBox コントロールを作成するコード例を次に示します。この例では、AcceptsTab、AcceptsReturn、WordWrap の各プロパティも使用して、テキスト ドキュメントを作成しやすいように複数行テキスト ボックス コントロールを設定します。
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 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!" & Environment.NewLine & "Second Line" End Sub
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 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!" + Environment.NewLine + "Second Line"; }
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 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!" + Environment::NewLine + "Second Line"; }
public void CreateMyMultilineTextBox() { // Create an instance of a TextBox control. TextBox textBox1 = new TextBox(); // Set the Multiline property to true. textBox1.set_Multiline(true); // Add vertical scroll bars to the TextBox control. textBox1.set_ScrollBars(ScrollBars.Vertical); // Allow the RETURN key in the TextBox control. textBox1.set_AcceptsReturn(true); // Allow the TAB key to be entered in the TextBox control. textBox1.set_AcceptsTab(true); // Set WordWrap to true to allow text to wrap to the next line. textBox1.set_WordWrap(true); // Set the default text of the control. textBox1.set_Text("Welcome!" + Environment.get_NewLine() + "Second Line"); } //CreateMyMultilineTextBox

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からTextBoxBase.Multiline プロパティを検索する場合は、下記のリンクをクリックしてください。

- TextBoxBase.Multiline プロパティのページへのリンク