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

Dim instance As TextBoxBase Dim value As Boolean value = instance.WordWrap instance.WordWrap = value
/** @property */ public boolean get_WordWrap () /** @property */ public void set_WordWrap (boolean value)
複数行テキスト ボックス コントロールで行が折り返される場合は true。ユーザーがコントロールの右端を超えてテキストを入力すると、複数行テキスト ボックス コントロールが自動的に水平にスクロールする場合は false。既定値は true です。

このプロパティが true に設定されている場合は、ScrollBars プロパティの設定値に関係なく、水平スクロール バーは表示されません。
![]() |
---|
派生クラス TextBox では、TextAlign プロパティが HorizontalAlignment.Left に設定されていない限り、このプロパティの設定値に関係なく、コントロール内のテキストの行は常に折り返されます。 |

派生クラス 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.WordWrap プロパティを検索する場合は、下記のリンクをクリックしてください。

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