1: using System;
2: using System.Windows.Forms;
3:
4: class Hello: Form
5: {
6: public static void Main()
7: {
8: Hello hw = new Hello();
9: Application.Run(hw);
10: }
11: }
1: using System;
2: using System.Windows.Forms;
3:
4: class Hello: Form
5: {
6: public static void Main()
7: {
8: Hello hw = new Hello();
9: hw.Text = "Hello, world!";
10: Application.Run(hw);
11: }
12: }
1: using System;
2: using System.Windows.Forms;
3:
4: class Hello: Form
5: {
6: public static void Main()
7: {
8: Hello hw = new Hello();
9: hw.Text = "アプリケーション名";
10:
11: Button btn = new Button();
12: btn.Parent = hw;
13: btn.Text = "Push";
14:
15: Application.Run(hw);
16: }
17: }
1: using System;
2: using System.Windows.Forms;
3:
4: class Hello: Form
5: {
6: static void btnOnClick(object sender, EventArgs e)
7: {
8: MessageBox.Show("押したね!");
9: }
10:
11: public static void Main()
12: {
13: Hello hw = new Hello();
14: hw.Text = "アプリケーション名";
15:
16: Button btn = new Button();
17: btn.Parent = hw;
18: btn.Text = "Push";
19: btn.Click += new EventHandler(btnOnClick);
20:
21: Application.Run(hw);
22: }
23: }
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: }
1: using System;
2: using System.Drawing;
3: using System.Windows.Forms;
4:
5: class Hello: Form
6: {
7: static void btn1OnClick(object sender, EventArgs e)
8: {
9: MessageBox.Show("正解!");
10: }
11:
12: static void btn2OnClick(object sender, EventArgs e)
13: {
14: MessageBox.Show("残念!");
15: }
16:
17: public static void Main()
18: {
19: Hello hw = new Hello();
20: hw.Text = "アプリケーション名";
21:
22: TextBox box = new TextBox();
23: box.Parent = hw;
24: box.Width = box.Width*2;
25: box.Text = "茨城の 県庁 所在地は?";
26:
27: Button btn1 = new Button();
28: btn1.Parent = hw;
29: btn1.Location = new Point(0, box.Height);
30: btn1.Text = "水戸市";
31: btn1.Click += new EventHandler(btn1OnClick);
32:
33: Button btn2 = new Button();
34: btn2.Parent = hw;
35: btn2.Location = new Point(0, box.Height + btn1.Height);
36: btn2.Text = "つくば市";
37: btn2.Click += new EventHandler(btn2OnClick);
38:
39: Application.Run(hw);
40: }
41: }