Partager via


TextBoxBase.BorderStyle Propriété

Définition

Obtient ou définit le type de bordure du contrôle de zone de texte.

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

Valeur de propriété

Qui BorderStyle représente le type de bordure du contrôle de zone de texte. La valeur par défaut est Fixed3D.

Exceptions

Valeur qui ne se trouve pas dans la plage de valeurs valides pour l’énumération a été affectée à la propriété.

Exemples

L’exemple de code suivant utilise TextBox, une classe dérivée, pour créer une zone de texte qui peut afficher correctement du texte à l’aide de 20 points Arial avec une seule bordure. Cet exemple utilise la PreferredHeight propriété pour déterminer la hauteur appropriée du contrôle après la police et BorderStyle affectée au contrôle.

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

Remarques

Vous pouvez utiliser la BorderStyle propriété pour créer des contrôles de style plat et sans bordure, en plus du contrôle tridimensionnel par défaut.

Note

La classe dérivée, , RichTextBoxne prend pas en charge le BorderStyle.FixedSingle style. Ce style entraîne l’utilisation BorderStyle du style à la BorderStyle.Fixed3D place.

S’applique à