Button Constructor

Definitie

Initialiseert een nieuw exemplaar van de Button klasse.

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

Voorbeelden

In het volgende codevoorbeeld wordt een Button, wordt de eigenschap ervan ingesteld DialogResult op de OK waarde van DialogResulten wordt deze toegevoegd aan een 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

Opmerkingen

Button Standaard wordt er geen bijschrift weergegeven. Als u de tekst van het bijschrift wilt opgeven, stelt u de Text eigenschap in.

Van toepassing op

Zie ook