forked from mono/winforms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswf-messagebox.cs
100 lines (80 loc) · 2.92 KB
/
swf-messagebox.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
using System;
using System.Drawing;
using System.Globalization;
using System.Windows.Forms;
using System.Threading;
namespace MyFormProject
{
public class MainForm : System.Windows.Forms.Form
{
static int count;
// Calendar
private System.Windows.Forms.Button button1;
public MainForm()
{
InitializeComponent();
}
private void InitializeComponent()
{
count = 0;
this.button1 = new Button();
this.button1.Location = new System.Drawing.Point(0, 0);
this.button1.Name = "label1";
this.button1.Size = new System.Drawing.Size(472, 23);
this.button1.TabIndex = 0;
this.button1.Text = "Click me for OK MessageBox";
this.button1.Dock = DockStyle.Fill;
this.button1.TextAlign = ContentAlignment.MiddleCenter;
this.button1.Click +=new EventHandler(button1_Click);
//
// MainForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(472, 382);
this.Controls.Add(this.button1);
this.Name = "MainForm";
this.Text = "SWF-MessageBox";
}
[STAThread]
static void Main()
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo( "de-DE", false );
Application.Run(new MainForm());
}
private void button1_Click(object sender, EventArgs e) {
DialogResult result;
switch (count) {
case 0: {
result = MessageBox.Show("Please click a button and verify that the proper result is reported in the main window.", "MessageBox Test", MessageBoxButtons.OK, MessageBoxIcon.Error);
this.button1.Text = "Last result was " + result + "\nClick to get OK/Cancel MessageBox";
break;
}
case 1: {
result = MessageBox.Show("Please click a button and verify that the proper result is reported in the main window.", "MessageBox Test", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
this.button1.Text = "Last result was " + result + "\nClick me for Yes/No MessageBox";
break;
}
case 2: {
result = MessageBox.Show("Please click a button and verify that the proper result is reported in the main window.", "MessageBox Test", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);
this.button1.Text = "Last result was " + result + "\nClick to exit the test application";
break;
}
case 3: {
result = MessageBox.Show("Please click a button and verify that the proper result is reported in the main window.", "MessageBox Test", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Warning);
this.button1.Text = "Last result was " + result + "\nClick to exit the test application";
break;
}
case 4: {
result = MessageBox.Show("Please click a button and verify that the proper result is reported in the main window.", "MessageBox Test", MessageBoxButtons.AbortRetryIgnore);
this.button1.Text = "Last result was " + result + "\nClick to exit the test application";
break;
}
case 5: {
Application.Exit();
break;
}
}
count++;
}
}
}