TextBoxBase.BorderStyle Vlastnost

Definice

Získá nebo nastaví typ ohraničení ovládacího prvku textové pole.

public:
 property System::Windows::Forms::BorderStyle BorderStyle { System::Windows::Forms::BorderStyle get(); void set(System::Windows::Forms::BorderStyle value); };
public System.Windows.Forms.BorderStyle BorderStyle { get; set; }
member this.BorderStyle : System.Windows.Forms.BorderStyle with get, set
Public Property BorderStyle As BorderStyle

Hodnota vlastnosti

A BorderStyle , který představuje typ ohraničení ovládacího prvku textového pole. Výchozí formát je Fixed3D.

Výjimky

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

Příklady

Následující příklad kódu používá TextBoxodvozenou třídu k vytvoření textového pole, které může správně zobrazit text pomocí 20bodového Arialu s jedním ohraničením. V tomto příkladu PreferredHeight se vlastnost používá k určení odpovídající výšky ovládacího prvku po písmu a BorderStyle byly přiřazeny ovládacímu prvku.

public:
   void CreateTextBox()
   {
      // Create an instance of the TextBox control.
      TextBox^ textBox1 = gcnew TextBox;
      
      // Set the TextBox Font property to Arial 20.
      textBox1->Font = gcnew System::Drawing::Font( "Arial", 20 );
      // Set the BorderStyle property to FixedSingle.
      textBox1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle;
      // Make the height of the control equal to the preferred height.
      textBox1->Height = textBox1->PreferredHeight;
   }
public void CreateTextBox()
 {
    // Create an instance of the TextBox control.
    TextBox textBox1 = new TextBox();
 
    // Set the TextBox Font property to Arial 20.
    textBox1.Font = new Font ("Arial" , 20);
    // Set the BorderStyle property to FixedSingle.
    textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
    // Make the height of the control equal to the preferred height.
    textBox1.Height = textBox1.PreferredHeight;
 }
Public Sub CreateTextBox()
    ' Create an instance of the TextBox control.
    Dim textBox1 As New TextBox()
    
    ' Set the TextBox Font property to Arial 20.
    textBox1.Font = New Font("Arial", 20)
    ' Set the BorderStyle property to FixedSingle.
    textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    ' Make the height of the control equal to the preferred height.
    textBox1.Height = textBox1.PreferredHeight
End Sub

Poznámky

Vlastnost můžete použít BorderStyle k vytvoření ovládacích prvků bez ohraničení a plochého stylu, kromě výchozího trojrozměrného ovládacího prvku.

Poznámka

Odvozená třída RichTextBoxnepodporuje BorderStyle.FixedSingle styl . Tento styl způsobí, BorderStyle že místo toho použije BorderStyle.Fixed3D tento styl.

Platí pro