Add a Button : Button « GUI Windows Form « C# / C Sharp
- C# / C Sharp
- GUI Windows Form
- Button
Add a Button

/*
C#: The Complete Reference
by Herbert Schildt
Publisher: Osborne/McGraw-Hill (March 8, 2002)
ISBN: 0072134852
*/
// Add a Button.
using System;
using System.Windows.Forms;
using System.Drawing;
public class ButtonForm : Form {
Button MyButton = new Button();
public ButtonForm() {
Text = "Using a Button";
MyButton = new Button();
MyButton.Text = "Press Here";
MyButton.Location = new Point(100, 200);
Controls.Add(MyButton);
}
[STAThread]
public static void Main() {
ButtonForm skel = new ButtonForm();
Application.Run(skel);
}
}
Related examples in the same category