Button Konstruktor

Definition

Initialisiert eine neue Instanz der Button-Klasse.

public:
 Button();
public Button ();
Public Sub New ()

Beispiele

Im folgenden Codebeispiel wird ein Button, legt seine DialogResult Eigenschaft auf den OK Wert von DialogResult, und fügt es zu einem Form.

private:
   void InitializeMyButton()
   {
      // Create and initialize a Button.
      Button^ button1 = gcnew Button;
      
      // Set the button to return a value of OK when clicked.
      button1->DialogResult = ::DialogResult::OK;
      
      // Add the button to the form.
      Controls->Add( button1 );
   }
private void InitializeMyButton()
 {
    // Create and initialize a Button.
    Button button1 = new Button();
 
    // Set the button to return a value of OK when clicked.
    button1.DialogResult = DialogResult.OK;
 
    // Add the button to the form.
    Controls.Add(button1);
 }
Private Sub InitializeMyButton()
    ' Create and initialize a Button.
    Dim button1 As New Button()
    
    ' Set the button to return a value of OK when clicked.
    button1.DialogResult = DialogResult.OK
    
    ' Add the button to the form.
    Controls.Add(button1)
End Sub

Hinweise

Standardmäßig wird keine Button Beschriftung angezeigt. Legen Sie die Text Eigenschaft fest, um den Beschriftungstext anzugeben.

Gilt für

Siehe auch