Button クラスの新しいインスタンスを初期化します。
Public Sub New()
[C#]
public Button();
[C++]
public: Button();
[JScript]
public function Button();
解説
既定では、 Button はキャプションを表示しません。キャプション テキストを指定するには、 Text プロパティを設定します。
使用例
Button を作成し、その DialogResult プロパティを DialogResult.OK に設定してから、 Form に追加する例を次に示します。
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 'InitializeMyButton
[C#]
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);
}
[C++]
private:
void InitializeMyButton() {
// Create and initialize a Button.
Button __gc *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);
};
[JScript]
private function InitializeMyButton()
{
// Create and initialize a Button.
var button1 : Button = new Button();
// Set the button to return a value of OK when clicked.
button1.DialogResult = System.Windows.Forms.DialogResult.OK;
// Add the button to the form.
Controls.Add(button1);
}
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET
参照
Button クラス | Button メンバ | System.Windows.Forms 名前空間 | Button