TextBoxBase.BorderStyle TextBoxBase.BorderStyle TextBoxBase.BorderStyle TextBoxBase.BorderStyle Property

Definición

Obtiene o establece el tipo de borde del control de cuadro de texto.Gets or sets the border type of the text box control.

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

Valor de propiedad

BorderStyle que representa el tipo de borde del control de cuadro de texto.A BorderStyle that represents the border type of the text box control. De manera predeterminada, es Fixed3D.The default is Fixed3D.

Excepciones

Se asignó a la propiedad un valor no situado dentro del intervalo de valores permitidos para la enumeración.A value that is not within the range of valid values for the enumeration was assigned to the property.

Ejemplos

En el ejemplo de código TextBoxsiguiente se usa, una clase derivada, para crear un cuadro de texto que puede mostrar correctamente el texto mediante Arial de 20 puntos con un solo borde.The following code example uses TextBox, a derived class, to create a text box that can properly display text using 20-point Arial with a single border. En este ejemplo se PreferredHeight utiliza la propiedad para determinar el alto adecuado del control después de la BorderStyle fuente y que se ha asignado al control.This example uses the PreferredHeight property to determine the appropriate height of the control after the font and BorderStyle have been assigned to the control.

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

Comentarios

Puede utilizar la BorderStyle propiedad para crear controles de estilo sin borde y sin formato, además del control tridimensional predeterminado.You can use the BorderStyle property to create borderless and flat style controls, in addition to the default three-dimensional control.

Nota

La clase derivada, RichTextBox, no admite el BorderStyle.FixedSingle estilo.The derived class, RichTextBox, does not support the BorderStyle.FixedSingle style. Este estilo hará BorderStyle que use el BorderStyle.Fixed3D estilo en su lugar.This style will cause the BorderStyle to use the BorderStyle.Fixed3D style instead.

Se aplica a