Freigeben über


TextBoxBase.BorderStyle Eigenschaft

Definition

Dient zum Abrufen oder Festlegen des Rahmentyps des Textfeld-Steuerelements.

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

Eigenschaftswert

Ein BorderStyle Wert, der den Rahmentyp des Textfeld-Steuerelements darstellt. Der Standardwert lautet Fixed3D.

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 TextBoxeine abgeleitete Klasse verwendet, um ein Textfeld zu erstellen, das Text mit 20 Punkt Arial mit einem einzigen Rahmen ordnungsgemäß anzeigen kann. In diesem Beispiel wird die PreferredHeight Eigenschaft verwendet, um die entsprechende Höhe des Steuerelements nach der Schriftart zu bestimmen und BorderStyle dem Steuerelement zugewiesen zu haben.

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

Hinweise

Sie können die BorderStyle Eigenschaft verwenden, um rahmenlose und flache Steuerelemente zusätzlich zum standardmäßigen dreidimensionalen Steuerelement zu erstellen.

Hinweis

Die abgeleitete Klasse unterstützt die BorderStyle.FixedSingle Formatvorlage RichTextBoxnicht. Diese Formatvorlage bewirkt stattdessen, dass die BorderStyleBorderStyle.Fixed3D Formatvorlage verwendet wird.

Gilt für: