Button Constructor

Definition

Button 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the Button class.
public:
 Button();
public Button ();
Public Sub New ()

Examples

다음 코드 예제에서는 Button만들고, DialogResult 속성을 DialogResultOK 값으로 설정 하 고,이를 Form에 추가 합니다.The following code example creates a Button, sets its DialogResult property to the OK value of DialogResult, and adds it to a 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

Remarks

기본적으로 Button는 캡션을 표시 하지 않습니다.By default the Button displays no caption. 캡션 텍스트를 지정 하려면 Text 속성을 설정 합니다.To specify the caption text, set the Text property.

Applies to

See also