サンプル  プログラム5

1: usingSystem;

2: usingSystem.Drawing;

3: usingSystem.Windows.Forms;

4:

5: classHello:Form

6: {

7:   staticvoidbtnOnClick(object sender, EventArgs e)

8:   {

9:     MessageBox.Show("したね!");

10:   }

11:

12:   publicstaticvoidMain()

13:   {

14:     Hellohw=newHello();

15:     hw.Text="アプリケーション名";

16:

17:     TextBoxbox=newTextBox();

18:     box.Parent=hw;

19:     box.Text="こんにちは";

20:

21:     Buttonbtn=newButton();

22:     btn.Parent=hw;

23:     btn.Location=newPoint(0, box.Height);

24:     btn.Text="Push";

25:     btn.Click+=newEventHandler(btnOnClick);

26:

27:     Application.Run(hw);

28:   }

29: }