TextBoxBase.BorderStyle Eigenschap
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee haalt u het randtype van het tekstvak besturingselement op of stelt u deze in.
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
Waarde van eigenschap
Een BorderStyle die het randtype van het tekstvak besturingselement vertegenwoordigt. De standaardwaarde is Fixed3D.
Uitzonderingen
Een waarde die zich niet binnen het bereik van geldige waarden voor de opsomming bevindt, is toegewezen aan de eigenschap.
Voorbeelden
In het volgende codevoorbeeld wordt een afgeleide klasse gebruikt TextBoxom een tekstvak te maken dat tekst correct kan weergeven met behulp van Arial met 20 punten met één rand. In dit voorbeeld wordt de PreferredHeight eigenschap gebruikt om de juiste hoogte van het besturingselement te bepalen nadat het lettertype is BorderStyle toegewezen aan het besturingselement.
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
Opmerkingen
U kunt de BorderStyle eigenschap gebruiken om randloze en platte stijlbesturingselementen te maken, naast het standaard driedimensionale besturingselement.
Note
De afgeleide klasse, RichTextBoxondersteunt de BorderStyle.FixedSingle stijl niet. Deze stijl zorgt ervoor dat de BorderStyleBorderStyle.Fixed3D stijl in plaats daarvan wordt gebruikt.