Sdílet prostřednictvím


TextBox.ScrollBars Vlastnost

Definice

Získá nebo nastaví, které posuvníky by se měly zobrazit ve víceřádkovém TextBox ovládacím prvku.

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

Hodnota vlastnosti

Jedna z hodnot výčtu ScrollBars , která označuje, zda se zobrazí víceřádkový TextBox ovládací prvek bez posuvníků, vodorovného posuvníku, svislého posuvníku nebo obojího. Výchozí hodnota je ScrollBars.None.

Výjimky

Hodnota, která není v rozsahu platných hodnot pro výčet byla přiřazena vlastnosti.

Příklady

Následující příklad kódu vytvoří víceřádkový TextBox ovládací prvek se svislými posuvníky. Tento příklad také používá AcceptsTab, AcceptsReturna WordWrap vlastnosti, aby víceřádkový TextBox ovládací prvek užitečný pro vytváření textových dokumentů.

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

Poznámky

Vodorovné posuvníky se nezobrazí, pokud WordWrap je vlastnost nastavena na true, bez ohledu na hodnotu ScrollBars vlastnosti.

Platí pro

Viz také