-
Notifications
You must be signed in to change notification settings - Fork 0
/
MsgBoxEx.cs
283 lines (278 loc) · 12.8 KB
/
MsgBoxEx.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
namespace MsgBoxEx
{
using System.Windows.Forms;
public static class MsgBox
{
/// <summary>
/// Displays a message box with specified text..
/// </summary>
/// <param name="msg">
/// The text to display in the message box.
/// </param>
/// <returns>
/// MsgBoxResult OK</returns>
public static MsgBoxResult Show(string msg)
{
return new MsgBoxExForm(msg).Show();
}
/// <summary>
/// Displays a message box with specified text and caption.
/// </summary>
/// <param name="message">
/// The text to display in the message box.
/// </param>
/// <param name="caption">
/// The text to display in the title bar of the message box.
/// </param>
/// <returns>
/// MessageBoxResult OK
/// </returns>
public static MsgBoxResult Show(string message, string caption)
{
return new MsgBoxExForm(message, caption).Show();
}
/// <summary>
/// Displays a message box with specified text, caption and buttons.
/// </summary>
/// <param name="message">
/// The text to display in the message box.
/// </param>
/// <param name="caption">
/// The text to display in the title bar of the message box.
/// </param>
/// <param name="msgBoxButtons">
/// One of the MsgBoxButtons values that specifies which
/// buttons to display.
/// </param>
/// <returns>
/// One of the MsgBoxResult values.
/// </returns>
public static MsgBoxResult Show(string message, string caption, MsgBoxButtons msgBoxButtons)
{
return new MsgBoxExForm(message, caption, msgBoxButtons).Show();
}
/// <summary>
/// Displays a message box with specified text, caption, buttons and Icon.
/// </summary>
/// <param name="message">
/// The text to display in the message box.
/// </param>
/// <param name="caption">
/// The text to display in the title bar of the message box.
/// </param>
/// <param name="msgBoxButtons">
/// One of the MsgBoxButtons values that specifies which
/// buttons to display.
/// </param>
/// <param name="icon">
/// One of the MsgBoxIcon values that specifies which icon
/// to display in the message box.
/// </param>
/// <returns>
/// One of the MsgBoxResult values.
/// </returns>
public static MsgBoxResult Show(string message, string caption, MsgBoxButtons msgBoxButtons, MsgBoxIcon icon)
{
return new MsgBoxExForm(message, caption, msgBoxButtons, icon).Show();
}
/// <summary>
/// Displays a message box with specified text, caption, buttons, Icon and default button.
/// </summary>
/// <param name="message">
/// The text to display in the message box.
/// </param>
/// <param name="caption">
/// The text to display in the title bar of the message box.
/// </param>
/// <param name="msgBoxButtons">
/// One of the MsgBoxButtons values that specifies which
/// buttons to display.
/// </param>
/// <param name="icon">
/// One of the MsgBoxIcon values that specifies which icon
/// to display in the message box.
/// <param name="defaultButton">
/// One of the MsgBoxDefaultButton values that specifies
/// the default button for the message box.
/// </param>
/// <returns>
/// One of the MsgBoxResult values.
/// </returns>
public static MsgBoxResult Show(string message, string caption, MsgBoxButtons msgBoxButtons, MsgBoxIcon icon, MsgBoxDefaultButton defaultButton)
{
return new MsgBoxExForm(message, caption, msgBoxButtons, icon, defaultButton).Show();
}
/// <summary>
/// Displays a message box with specified text, caption, buttons, Icon, default button and a Do not show again Check box.
/// To get the result of the check box, add: Syste.Windows.Forms.CheckState doNotShowAgain = System.Windows.Forms.CheckState.Indeterminate;
/// Before the MsgBox call.
/// </summary>
/// <param name="message">
/// The text to display in the message box.
/// </param>
/// <param name="caption">
/// The text to display in the title bar of the message box.
/// </param>
/// <param name="msgBoxButtons">
/// One of the MsgBoxButtons values that specifies which
/// buttons to display.
/// </param>
/// <param name="icon">
/// One of the MsgBoxIcon values that specifies which icon
/// to display in the message box.
/// <param name="defaultButton">
/// One of the MsgBoxDefaultButton values that specifies
/// the default button for the message box.
/// </param>
/// <param name="doNotShowAgain">
/// Show (checked) or hide the Do not show again check box.
/// </param>
/// <param name="checkBoxState">
/// The checked state of the Do not show again check box.
/// </param>
/// <returns>
/// One of the MsgBoxResult values.
/// The state of the Do not show again check box.
/// </returns>
public static MsgBoxResult Show(string message, string caption, MsgBoxButtons msgBoxButtons, MsgBoxIcon icon, MsgBoxDefaultButton defaultButton,
MsgBoxCheckBox doNotShowAgain, out CheckState checkBoxState)
{
return new MsgBoxExForm(message, caption, msgBoxButtons, icon, defaultButton, doNotShowAgain).Show(out checkBoxState);
}
/// <summary>
/// Displays a message box with specified text, caption, buttons, Icon, default button, a Do not show again Check box,
/// custom Text color using a hexadecimal color (web color code #0000FF = Blue text).
/// To get the result of the check box, add: Syste.Windows.Forms.CheckState doNotShowAgain = System.Windows.Forms.CheckState.Indeterminate;
/// Before the MsgBox call.
/// </summary>
/// <param name="message">
/// The text to display in the message box.
/// </param>
/// <param name="caption">
/// The text to display in the title bar of the message box.
/// </param>
/// <param name="msgBoxButtons">
/// One of the MsgBoxButtons values that specifies which
/// buttons to display.
/// </param>
/// <param name="icon">
/// One of the MsgBoxIcon values that specifies which icon
/// to display in the message box.
/// <param name="defaultButton">
/// One of the MsgBoxDefaultButton values that specifies
/// the default button for the message box.
/// </param>
/// <param name="doNotShowAgain">
/// Show (checked) or hide the Do not show again check box.
/// </param>
/// <param name="checkBoxState">
/// The checked state of the Do not show again check box.
/// </param>
/// <param name="textColor">
/// A hexadecimal color code (web color code #FF0000 = Red)
/// </param>
/// <returns>
/// One of the MsgBoxResult values.
/// The state of the Do not show again check box.
/// </returns>
public static MsgBoxResult Show(string message, string caption, MsgBoxButtons msgBoxButtons, MsgBoxIcon icon, MsgBoxDefaultButton defaultButton,
MsgBoxCheckBox doNotShowAgain, out CheckState checkBoxState, string textColor)
{
return new MsgBoxExForm(message, caption, msgBoxButtons, icon, defaultButton, doNotShowAgain, textColor).Show(out checkBoxState);
}
/// <summary>
/// Displays a message box with specified text, caption, buttons, Icon, default button, a Do not show again Check box,
/// custom Text color using a hexadecimal color (web color code #0000FF = Blue text) and custom form background color
/// using a hexadecimal color (web color code #C0C0C0 = Silver background) (The button bar is automatic set to a darker color than the form background.).
/// To get the result of the check box, add: Syste.Windows.Forms.CheckState doNotShowAgain = System.Windows.Forms.CheckState.Indeterminate;
/// Before the MsgBox call.
/// </summary>
/// <param name="message">
/// The text to display in the message box.
/// </param>
/// <param name="caption">
/// The text to display in the title bar of the message box.
/// </param>
/// <param name="msgBoxButtons">
/// One of the MsgBoxButtons values that specifies which
/// buttons to display.
/// </param>
/// <param name="icon">
/// One of the MsgBoxIcon values that specifies which icon
/// to display in the message box.
/// <param name="defaultButton">
/// One of the MsgBoxDefaultButton values that specifies
/// the default button for the message box.
/// </param>
/// <param name="doNotShowAgain">
/// Show (checked) or hide the Do not show again check box.
/// </param>
/// <param name="checkBoxState">
/// The checked state of the Do not show again check box.
/// </param>
/// <param name="textColor">
/// A hexadecimal color code (web color code #FF0000 = Red)
/// </param>
/// <param name="formColor">
/// A hexadecimal color code (web color code #FFFFFF = White)
/// </param>
/// <returns>
/// One of the MsgBoxResult values.
/// The state of the Do not show again check box.
/// </returns>
public static MsgBoxResult Show(string message, string caption, MsgBoxButtons msgBoxButtons, MsgBoxIcon icon, MsgBoxDefaultButton defaultButton,
MsgBoxCheckBox doNotShowAgain, out CheckState checkBoxState, string textColor, string formColor)
{
return new MsgBoxExForm(message, caption, msgBoxButtons, icon, defaultButton, doNotShowAgain, textColor, formColor).Show(out checkBoxState);
}
/// <summary>
/// Displays a message box with specified text, caption, buttons, Icon, default button, a Do not show again Check box,
/// custom Text color using a hexadecimal color (web color code #0000FF = Blue text), custom form background color
/// using a hexadecimal color (web color code #C0C0C0 = Silver background) (The button bar is automatic set to a darker color than the form background.)
/// and MsgBox order (TopMost).
/// To get the result of the check box, add: Syste.Windows.Forms.CheckState doNotShowAgain = System.Windows.Forms.CheckState.Indeterminate;
/// Before the MsgBox call.
/// </summary>
/// <param name="message">
/// The text to display in the message box.
/// </param>
/// <param name="caption">
/// The text to display in the title bar of the message box.
/// </param>
/// <param name="msgBoxButtons">
/// One of the MsgBoxButtons values that specifies which
/// buttons to display.
/// </param>
/// <param name="icon">
/// One of the MsgBoxIcon values that specifies which icon
/// to display in the message box.
/// <param name="defaultButton">
/// One of the MsgBoxDefaultButton values that specifies
/// the default button for the message box.
/// </param>
/// <param name="doNotShowAgain">
/// Show (checked) or hide the Do not show again check box.
/// </param>
/// <param name="checkBoxState">
/// The checked state of the Do not show again check box.
/// </param>
/// <param name="textColor">
/// A hexadecimal color code (web color code #FF0000 = Red)
/// </param>
/// <param name="formColor">
/// A hexadecimal color code (web color code #FFFFFF = White)
/// </param>
/// <param name="topMost">
/// State of the message box Z index (TopMost)
/// </param>
/// <returns>
/// One of the MsgBoxResult values.
/// The state of the Do not show again check box.
/// </returns>
public static MsgBoxResult Show(string message, string caption, MsgBoxButtons msgBoxButtons, MsgBoxIcon icon, MsgBoxDefaultButton defaultButton,
MsgBoxCheckBox doNotShowAgain, out CheckState checkBoxState, string textColor, string formColor, MsgBoxOrder topMost)
{
return new MsgBoxExForm(message, caption, msgBoxButtons, icon, defaultButton, doNotShowAgain, textColor, formColor, topMost).Show(out checkBoxState);
}
}
}