Button 생성자

정의

Button 클래스의 새 인스턴스를 초기화합니다.

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

예제

다음 코드 예제에서는 만들고Button, 해당 DialogResult 속성을 값DialogResult으로 OK 설정하고, 에 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

설명

기본적으로 캡션은 Button 표시되지 않습니다. 캡션 텍스트를 지정하려면 속성을 설정합니다 Text .

적용 대상

추가 정보