using System;
using System.Drawing;
using System.Windows.Forms;
public class MainForm : Form
{
public static void Main()
{
MainForm MyForm = new MainForm();
Application.Run(MyForm);
}
public MainForm()
{
Button MyButton = new Button();
Text = "Button Test";
MyButton.Location = new Point(25, 25);
MyButton.Text = "Click Me";
MyButton.Click += new EventHandler(MyButtonClicked);
Controls.Add(MyButton);
}
public void MyButtonClicked(object sender, EventArgs Arguments)
{
MessageBox.Show("The button has been clicked.");
}
}
|