## サンプル プログラム 5

1: using System;

2: using System.Drawing;

3: using System.Windows.Forms;

4:

5: class Hello: Form

6:{

7: static void btnOnClick(object sender,EventArgs e)

8: {

9: MessageBox.Show("押おしたね！");

10: }

11:

12: public static void Main()

13: {

14: Hello hw = new Hello();

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

16:

17: TextBox box = new TextBox();

18: box.Parent = hw;

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

20:

21: Button btn = new Button();

22: btn.Parent = hw;

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

24: btn.Text = "Push";

25: btn.Click += new EventHandler(btnOnClick);

26:

27: Application.Run(hw);

28: }

29:}