TextBox.ScrollBars Eigenschaft
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Ruft ab oder legt fest, welche Bildlaufleisten in einem mehrteiligen TextBox Steuerelement angezeigt werden sollen.
public:
property System::Windows::Forms::ScrollBars ScrollBars { System::Windows::Forms::ScrollBars get(); void set(System::Windows::Forms::ScrollBars value); };
public System.Windows.Forms.ScrollBars ScrollBars { get; set; }
member this.ScrollBars : System.Windows.Forms.ScrollBars with get, set
Public Property ScrollBars As ScrollBars
Eigenschaftswert
Einer der Enumerationswerte, der ScrollBars angibt, ob ein mehrteiliges TextBox Steuerelement ohne Bildlaufleisten, eine horizontale Bildlaufleiste, eine vertikale Bildlaufleiste oder beides angezeigt wird. Der Standardwert lautet ScrollBars.None.
Ausnahmen
Ein Wert, der sich nicht innerhalb des Bereichs gültiger Werte für die Enumeration befindet, wurde der Eigenschaft zugewiesen.
Beispiele
Im folgenden Codebeispiel wird ein mehrteiliges TextBox Steuerelement mit vertikalen Bildlaufleisten erstellt. In diesem Beispiel werden auch die AcceptsTabMehrzeilensteuerelemente AcceptsReturnund WordWrap Eigenschaften verwendet, um das mehrteilige TextBox Steuerelement zum Erstellen von Textdokumenten nützlich zu machen.
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 TAB 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 TAB 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 TAB 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
Hinweise
Horizontale Bildlaufleisten werden nicht angezeigt, wenn die WordWrap Eigenschaft unabhängig vom Wert der ScrollBars Eigenschaft auf "trueFestgelegt" festgelegt ist.