Nyelv

TextBox.ScrollBars Tulajdonság

Definíció

Lekérdezi vagy beállítja, hogy mely görgetősávok jelenjenek meg egy többsoros TextBox vezérlőben.

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

Tulajdonság értéke

Az egyik ScrollBars számbavételi érték, amely azt jelzi, hogy egy többsoros TextBox vezérlőelem görgetősávok, vízszintes görgetősáv, függőleges görgetősáv vagy mindkettő nélkül jelenik-e meg. Az alapértelmezett érték a ScrollBars.None.

Kivételek

A tulajdonsághoz egy olyan érték lett hozzárendelve, amely nem esik az enumerálás érvényes értékeinek tartományán belül.

Példák

Az alábbi példakód egy többsoros TextBox vezérlőt hoz létre függőleges görgetősávokkal. Ez a példa a AcceptsTab, AcceptsReturnés WordWrap a tulajdonságok használatával is hasznossá teszi a többsoros TextBox vezérlőt a szöveges dokumentumok létrehozásához.

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

Megjegyzések

A vízszintes görgetősávok nem jelennek meg, ha a WordWrap tulajdonság értéke a tulajdonság értékétől true függetlenül van beállítvaScrollBars.

A következőre érvényes:

Lásd még