Fix bug #395
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / MessageBox.cs
1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
8 //
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
11 //
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 //
20 // Copyright (c) 2004-2006 Novell, Inc.
21 //
22 // Authors:
23 //      Jordi Mas i Hernandez   (jordi@ximian.com)
24 //      Benjamin Dasnois        (benjamin.dasnois@gmail.com)
25 //      Robert Thompson         (rmt@corporatism.org)
26 //      Peter Bartok            (pbartok@novell.com)
27 //
28 // TODO:
29 //      - Add support for MessageBoxOptions and MessageBoxDefaultButton.
30 //
31
32
33 // NOT COMPLETE
34
35 using System;
36 using System.Drawing;
37 using System.Globalization;
38 using System.Resources;
39
40 namespace System.Windows.Forms
41 {
42         public class MessageBox
43         {
44                 #region Private MessageBoxForm class
45                 internal class MessageBoxForm : Form
46                 {
47                         #region MessageBoxFrom Local Variables
48                         const int space_border = 10;
49                         const int button_width = 86;
50                         const int button_height = 23;
51                         const int button_space = 5;
52                         const int space_image_text= 10;
53
54                         string                  msgbox_text;
55                         bool                    size_known      = false;
56                         Icon                    icon_image;
57                         RectangleF              text_rect;
58                         MessageBoxButtons       msgbox_buttons;
59                         MessageBoxDefaultButton msgbox_default;
60                         bool                    buttons_placed  = false;
61                         int                     button_left;
62                         Button[]                buttons = new Button[4];
63                         bool                    show_help;
64                         string help_file_path;
65                         string help_keyword;
66                         HelpNavigator help_navigator;
67                         object help_param;
68                         AlertType               alert_type;
69                         #endregion      // MessageBoxFrom Local Variables
70                         
71                         #region MessageBoxForm Constructors
72                         public MessageBoxForm (IWin32Window owner, string text, string caption,
73                                                MessageBoxButtons buttons, MessageBoxIcon icon,
74                                                bool displayHelpButton)
75                         {
76                                 show_help = displayHelpButton;
77
78                                 switch (icon) {
79                                         case MessageBoxIcon.None: {
80                                                 icon_image = null;
81                                                 alert_type = AlertType.Default;
82                                                 break;
83                                         }
84
85                                         case MessageBoxIcon.Error: {            // Same as MessageBoxIcon.Hand and MessageBoxIcon.Stop
86                                                 icon_image = SystemIcons.Error;
87                                                 alert_type = AlertType.Error;
88                                                 break;
89                                         }
90
91                                         case MessageBoxIcon.Question: {
92                                                 icon_image = SystemIcons.Question;
93                                                 alert_type = AlertType.Question;
94                                                 break;
95                                         }
96
97                                         case MessageBoxIcon.Asterisk: {         // Same as MessageBoxIcon.Information
98                                                 icon_image = SystemIcons.Information;
99                                                 alert_type = AlertType.Information;
100                                                 break;
101                                         }
102
103                                         case MessageBoxIcon.Warning: {          // Same as MessageBoxIcon.Exclamation:
104                                                 icon_image = SystemIcons.Warning;
105                                                 alert_type = AlertType.Warning;
106                                                 break;
107                                         }
108                                 }
109
110                                 msgbox_text = text;
111                                 msgbox_buttons = buttons;
112                                 msgbox_default = MessageBoxDefaultButton.Button1;
113
114                                 if (owner != null) {
115                                         Owner = Control.FromHandle(owner.Handle).FindForm();
116                                 } else {
117                                         if (Application.MWFThread.Current.Context != null) {
118                                                 Owner = Application.MWFThread.Current.Context.MainForm;
119                                         }
120                                 }
121                                 this.Text = caption;
122                                 this.ControlBox = true;
123                                 this.MinimizeBox = false;
124                                 this.MaximizeBox = false;
125                                 this.ShowInTaskbar = (Owner == null);
126                                 this.FormBorderStyle = FormBorderStyle.FixedDialog;
127                         }
128
129                         public MessageBoxForm (IWin32Window owner, string text, string caption,
130                                         MessageBoxButtons buttons, MessageBoxIcon icon,
131                                         MessageBoxDefaultButton defaultButton, MessageBoxOptions options, bool displayHelpButton)
132                                 : this (owner, text, caption, buttons, icon, displayHelpButton)
133                         {
134                                 msgbox_default = defaultButton;
135                         }
136
137                         public MessageBoxForm (IWin32Window owner, string text, string caption,
138                                                MessageBoxButtons buttons, MessageBoxIcon icon)
139                                 : this (owner, text, caption, buttons, icon, false)
140                         {
141                         }
142                         #endregion      // MessageBoxForm Constructors
143
144                         #region Protected Instance Properties
145                         protected override CreateParams CreateParams {
146                                 get {
147                                         CreateParams cp = base.CreateParams;;
148
149                                         cp.Style |= (int)(WindowStyles.WS_DLGFRAME | WindowStyles.WS_CLIPCHILDREN | WindowStyles.WS_CLIPSIBLINGS | WindowStyles.WS_CAPTION);
150                                         
151                                         if (!is_enabled)
152                                                 cp.Style |= (int)(WindowStyles.WS_DISABLED);
153
154                                         return cp;
155                                 }
156                         }
157                         #endregion      // Protected Instance Properties
158
159                         #region MessageBoxForm Methods
160                         public void SetHelpData (string file_path, string keyword, HelpNavigator navigator, object param)
161                         {
162                                 help_file_path = file_path;
163                                 help_keyword = keyword;
164                                 help_navigator = navigator;
165                                 help_param = param;
166                         }
167                         
168                         internal string HelpFilePath {
169                                 get { return help_file_path; }
170                         }
171                         
172                         internal string HelpKeyword {
173                                 get { return help_keyword; }
174                         }
175                         
176                         internal HelpNavigator HelpNavigator {
177                                 get { return help_navigator; }
178                         }
179                         
180                         internal object HelpParam {
181                                 get { return help_param; }
182                         }
183                         
184                         public DialogResult RunDialog ()
185                         {
186                                 this.StartPosition = FormStartPosition.CenterScreen;
187
188                                 if (size_known == false) {
189                                         InitFormsSize ();
190                                 }
191
192                                 if (Owner != null)
193                                         TopMost = Owner.TopMost;
194                                         
195                                 XplatUI.AudibleAlert (alert_type);
196                                 this.ShowDialog ();
197
198                                 return this.DialogResult;
199                         }
200
201                         internal override void OnPaintInternal (PaintEventArgs e)
202                         {
203                                 e.Graphics.DrawString (msgbox_text, this.Font, ThemeEngine.Current.ResPool.GetSolidBrush (Color.Black), text_rect);
204                                 if (icon_image != null) {
205                                         e.Graphics.DrawIcon(icon_image, space_border, space_border);
206                                 }
207                         }
208
209                         private void InitFormsSize ()
210                         {
211                                 int tb_width = 0;
212
213                                 // Max width of messagebox must be 60% of screen width
214                                 int max_width = (int) (Screen.GetWorkingArea (this).Width * 0.6);
215
216                                 // First we have to know the size of text + image
217                                 Drawing.SizeF tsize = TextRenderer.MeasureString (msgbox_text, this.Font, max_width);
218                                 text_rect.Size = tsize;
219                                 
220                                 if (icon_image != null) {
221                                         tsize.Width += icon_image.Width + 10;
222                                         if(icon_image.Height > tsize.Height) {
223                                                 // Place text middle-right
224                                                 text_rect.Location = new Point (icon_image.Width + space_image_text + space_border, (int)((icon_image.Height/2)-(tsize.Height/2)) + space_border);
225                                         } else {
226                                                 text_rect.Location = new Point (icon_image.Width + space_image_text + space_border, 2 + space_border);
227                                         }
228                                         if (tsize.Height < icon_image.Height)
229                                                 tsize.Height = icon_image.Height;
230                                 } else {
231                                         text_rect.Location = new Point (space_border + button_space, space_border);
232                                 }
233                                 tsize.Height += space_border * 2;
234
235                                 // Now we want to know the amount of buttons
236                                 int buttoncount;
237                                 switch (msgbox_buttons) {
238                                         case MessageBoxButtons.OK:
239                                                 buttoncount = 1;
240                                                 break;
241
242                                         case MessageBoxButtons.OKCancel:
243                                                 buttoncount = 2;
244                                                 break;
245
246                                         case MessageBoxButtons.AbortRetryIgnore:
247                                                 buttoncount = 3;
248                                                 break;
249
250                                         case MessageBoxButtons.YesNoCancel:
251                                                 buttoncount = 3;
252                                                 break;
253
254                                         case MessageBoxButtons.YesNo:
255                                                 buttoncount = 2;
256                                                 break;
257
258                                         case MessageBoxButtons.RetryCancel:
259                                                 buttoncount = 2;
260                                                 break;
261                                         
262                                         default:
263                                                 buttoncount = 0;
264                                                 break;
265                                 
266                                 }
267                                 if (show_help)
268                                         buttoncount ++;
269                                 
270                                 // Calculate the width based on amount of buttons 
271                                 tb_width = (button_width + button_space) * buttoncount;  
272
273                                 // The form caption can also make us bigger
274                                 SizeF caption = TextRenderer.MeasureString (Text, new Font (DefaultFont, FontStyle.Bold));
275                                 
276                                 // Use the bigger of the caption size (plus some arbitrary borders/close button)
277                                 // or the text size, up to 60% of the screen (max_size)
278                                 Size new_size = new SizeF (Math.Min (Math.Max (caption.Width + 40, tsize.Width), max_width), tsize.Height).ToSize ();
279                                 
280                                 // Now we choose the good size for the form
281                                 if (new_size.Width > tb_width)
282                                         this.ClientSize = new Size (new_size.Width + (space_border * 2), Height = new_size.Height + (space_border * 4));
283                                 else
284                                         this.ClientSize = new Size (tb_width + (space_border * 2), Height = new_size.Height + (space_border * 4));
285
286                                 // Now we set the left of the buttons
287                                 button_left = (this.ClientSize.Width / 2) - (tb_width / 2) + 5;
288                                 AddButtons ();
289                                 size_known = true;
290
291                                 // Still needs to implement defaultButton and options
292                                 switch(msgbox_default) {
293                                         case MessageBoxDefaultButton.Button2: {
294                                                 if (this.buttons[1] != null) {
295                                                         ActiveControl = this.buttons[1];
296                                                 }
297                                                 break;
298                                         }
299
300                                         case MessageBoxDefaultButton.Button3: {
301                                                 if (this.buttons[2] != null) {
302                                                         ActiveControl = this.buttons[2];
303                                                 }
304                                                 break;
305                                         }
306                                 }
307                         }
308
309                         protected override bool ProcessDialogKey(Keys keyData) {
310                                 if (keyData == Keys.Escape) {
311                                         this.CancelClick(this, null);
312                                         return true;
313                                 }
314
315                                 if (((keyData & Keys.Modifiers) == Keys.Control) &&
316                                         (((keyData & Keys.KeyCode) == Keys.C) ||
317                                          ((keyData & Keys.KeyCode) == Keys.Insert))) {  
318                                         Copy();
319                                 }
320
321                                 return base.ProcessDialogKey (keyData);
322                         }
323
324                         protected override bool ProcessDialogChar (char charCode)
325                         {
326                                 // Shortcut keys, kinda like mnemonics, except you don't have to press Alt
327                                 if ((charCode == 'N' || charCode == 'n') && (CancelButton != null && (CancelButton as Button).Text == "No"))
328                                         CancelButton.PerformClick ();
329                                 else if ((charCode == 'Y' || charCode == 'y') && (AcceptButton as Button).Text == "Yes")
330                                         AcceptButton.PerformClick ();
331                                 else if ((charCode == 'A' || charCode == 'a') && (CancelButton != null && (CancelButton as Button).Text == "Abort"))
332                                         CancelButton.PerformClick ();
333                                 else if ((charCode == 'R' || charCode == 'r') && (AcceptButton as Button).Text == "Retry")
334                                         AcceptButton.PerformClick ();
335                                 else if ((charCode == 'I' || charCode == 'i') && buttons.Length >= 3 && buttons[2].Text == "Ignore")
336                                         buttons[2].PerformClick ();
337                                 
338                                 return base.ProcessDialogChar (charCode);
339                         }
340                         
341                         private void Copy ()
342                         {
343                                 string separator = "---------------------------" + Environment.NewLine;
344
345                                 System.Text.StringBuilder contents = new System.Text.StringBuilder ();
346
347                                 contents.Append (separator);
348                                 contents.Append (this.Text).Append (Environment.NewLine);
349                                 contents.Append (separator);
350                                 contents.Append (msgbox_text).Append (Environment.NewLine);
351                                 contents.Append (separator);
352
353                                 foreach (Button btn in buttons) {
354                                         if (btn == null)
355                                                 break;
356                                         contents.Append (btn.Text).Append ("   ");;
357                                 }
358
359                                 contents.Append (Environment.NewLine);
360                                 contents.Append (separator);
361
362                                 DataObject obj = new DataObject(DataFormats.Text, contents.ToString());
363                                 Clipboard.SetDataObject (obj);
364                         }
365
366                         #endregion      // MessageBoxForm Methods
367
368                         #region Functions for Adding buttons
369                         private void AddButtons()
370                         {
371                                 if (!buttons_placed) {
372                                         switch (msgbox_buttons) {
373                                                 case MessageBoxButtons.OK: {
374                                                         buttons[0] = AddOkButton (0);
375                                                         break;
376                                                 }
377
378                                                 case MessageBoxButtons.OKCancel: {
379                                                         buttons[0] = AddOkButton (0);
380                                                         buttons[1] = AddCancelButton (1);
381                                                         break;
382                                                 }
383
384                                                 case MessageBoxButtons.AbortRetryIgnore: {
385                                                         buttons[0] = AddAbortButton (0);
386                                                         buttons[1] = AddRetryButton (1);
387                                                         buttons[2] = AddIgnoreButton (2);
388                                                         break;
389                                                 }
390
391                                                 case MessageBoxButtons.YesNoCancel: {
392                                                         buttons[0] = AddYesButton (0);
393                                                         buttons[1] = AddNoButton (1);
394                                                         buttons[2] = AddCancelButton (2);
395                                                         break;
396                                                 }
397
398                                                 case MessageBoxButtons.YesNo: {
399                                                         buttons[0] = AddYesButton (0);
400                                                         buttons[1] = AddNoButton (1);
401                                                         break;
402                                                 }
403
404                                                 case MessageBoxButtons.RetryCancel: {
405                                                         buttons[0] = AddRetryButton (0);
406                                                         buttons[1] = AddCancelButton (1);
407                                                         break;
408                                                 }
409                                         }
410
411                                         if (show_help) {
412                                                 for (int i = 0; i <= 3; i++) {
413                                                         if (buttons [i] == null) {
414                                                                 AddHelpButton (i);
415                                                                 break;
416                                                         }
417                                                 }
418                                         }
419
420                                         buttons_placed = true;
421                                 }
422                         }
423
424                         private Button AddButton (string text, int left, EventHandler click_event)
425                         {
426                                 Button button = new Button ();
427                                 button.Text = Locale.GetText(text);
428                                 button.Width = button_width;
429                                 button.Height = button_height;
430                                 button.Top = this.ClientSize.Height - button.Height - space_border;
431                                 button.Left =  ((button_width + button_space) * left) + button_left;
432                                 
433                                 if (click_event != null)
434                                         button.Click += click_event;
435                                 
436                                 if ((text == "OK") || (text == "Retry") || (text == "Yes")) 
437                                         AcceptButton = button;
438                                 else if ((text == "Cancel") || (text == "Abort") || (text == "No"))
439                                         CancelButton = button;
440                                 
441                                 this.Controls.Add (button);
442
443                                 return button;
444                         }
445
446                         private Button AddOkButton (int left)
447                         {
448                                 return AddButton ("OK", left, new EventHandler (OkClick));
449                         }
450
451                         private Button AddCancelButton (int left)
452                         {
453                                 return AddButton ("Cancel", left, new EventHandler (CancelClick));
454                         }
455
456                         private Button AddAbortButton (int left)
457                         {
458                                 return AddButton ("Abort", left, new EventHandler (AbortClick));
459                         }
460
461                         private Button AddRetryButton(int left)
462                         {
463                                 return AddButton ("Retry", left, new EventHandler (RetryClick));
464                         }
465
466                         private Button AddIgnoreButton (int left)
467                         {
468                                 return AddButton ("Ignore", left, new EventHandler (IgnoreClick));
469                         }
470
471                         private Button AddYesButton (int left)
472                         {
473                                 return AddButton ("Yes", left, new EventHandler (YesClick));
474                         }
475
476                         private Button AddNoButton (int left)
477                         {
478                                 return AddButton ("No", left, new EventHandler (NoClick));
479                         }
480
481                         private Button AddHelpButton (int left)
482                         {
483                                 Button button = AddButton ("Help", left, null);
484                                 button.Click += delegate { Owner.RaiseHelpRequested (new HelpEventArgs (Owner.Location)); };
485                                 return button;
486                         }
487                         #endregion
488
489                         #region Button click handlers
490                         private void OkClick (object sender, EventArgs e)
491                         {
492                                 this.DialogResult = DialogResult.OK;
493                                 this.Close ();
494                         }
495
496                         private void CancelClick (object sender, EventArgs e)
497                         {
498                                 this.DialogResult = DialogResult.Cancel;
499                                 this.Close ();
500                         }
501
502                         private void AbortClick (object sender, EventArgs e)
503                         {
504                                 this.DialogResult = DialogResult.Abort;
505                                 this.Close ();
506                         }
507
508                         private void RetryClick (object sender, EventArgs e)
509                         {
510                                 this.DialogResult = DialogResult.Retry;
511                                 this.Close ();
512                         }
513
514                         private void IgnoreClick (object sender, EventArgs e)
515                         {
516                                 this.DialogResult = DialogResult.Ignore;
517                                 this.Close ();
518                         }
519
520                         private void YesClick (object sender, EventArgs e)
521                         {
522                                 this.DialogResult = DialogResult.Yes;
523                                 this.Close ();
524                         }
525
526                         private void NoClick (object sender, EventArgs e)
527                         {
528                                 this.DialogResult = DialogResult.No;
529                                 this.Close ();
530                         }
531                         #endregion
532
533                         #region UIA Framework: Methods, Properties and Events
534
535                         internal string UIAMessage {
536                                 get { return msgbox_text; }
537                         }
538
539                         internal Rectangle UIAMessageRectangle {
540                                 get { 
541                                         return new Rectangle ((int) text_rect.X,
542                                                               (int) text_rect.Y, 
543                                                               (int) text_rect.Width, 
544                                                               (int) text_rect.Height); 
545                                 }
546                         }
547
548                         internal Rectangle UIAIconRectangle {
549                                 get { 
550                                         return new Rectangle (space_border, 
551                                                               space_border, 
552                                                               icon_image == null ? -1 : icon_image.Width, 
553                                                               icon_image == null ? -1 : icon_image.Height);
554                                 }
555                         }
556
557                         #endregion
558                 }
559                 #endregion      // Private MessageBoxForm class
560
561
562                 #region Constructors
563                 private MessageBox ()
564                 {
565                 }
566                 #endregion      // Constructors
567
568                 #region Public Static Methods
569                 public static DialogResult Show (string text)
570                 {
571                         MessageBoxForm form = new MessageBoxForm (null, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None);
572
573                         return form.RunDialog ();
574                 }
575
576                 public static DialogResult Show (IWin32Window owner, string text)
577                 {
578                         MessageBoxForm form = new MessageBoxForm (owner, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None);
579                                 
580                         return form.RunDialog ();
581                 }
582
583                 public static DialogResult Show (string text, string caption)
584                 {
585                         MessageBoxForm form = new MessageBoxForm (null, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None);
586
587                         return form.RunDialog ();
588                 }
589
590                 public static DialogResult Show (string text, string caption, MessageBoxButtons buttons)
591                 {
592                         MessageBoxForm form = new MessageBoxForm (null, text, caption, buttons, MessageBoxIcon.None);
593                                 
594                         return form.RunDialog ();
595                 }
596
597                 public static DialogResult Show (IWin32Window owner, string text, string caption,
598                                                  MessageBoxButtons buttons)
599                 {
600                         MessageBoxForm form = new MessageBoxForm (owner, text, caption, buttons, MessageBoxIcon.None);
601                                 
602                         return form.RunDialog ();
603                 }
604
605                 public static DialogResult Show (IWin32Window owner, string text, string caption,
606                                                  MessageBoxButtons buttons, MessageBoxIcon icon)
607                 {
608                         MessageBoxForm form = new MessageBoxForm (owner, text, caption, buttons, icon);
609                                 
610                         return form.RunDialog ();
611                 }
612
613
614                 public static DialogResult Show (IWin32Window owner, string text, string caption)
615                 {
616                         MessageBoxForm form = new MessageBoxForm (owner, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None);
617                                 
618                         return form.RunDialog ();
619                 }
620
621
622                 public static DialogResult Show (string text, string caption, MessageBoxButtons buttons,
623                                 MessageBoxIcon icon)
624                 {
625                         MessageBoxForm form = new MessageBoxForm (null, text, caption, buttons, icon);
626                                 
627                         return form.RunDialog ();
628                 }
629
630                 public static DialogResult Show (string text, string caption, MessageBoxButtons buttons,
631                                                  MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
632                 {
633
634                         MessageBoxForm form = new MessageBoxForm (null, text, caption, buttons,
635                                                                   icon, defaultButton, MessageBoxOptions.DefaultDesktopOnly, false);
636                                 
637                         return form.RunDialog ();
638                 }
639
640                 public static DialogResult Show (IWin32Window owner, string text, string caption,
641                                                  MessageBoxButtons buttons, MessageBoxIcon icon,
642                                                  MessageBoxDefaultButton defaultButton)
643                 {
644                         MessageBoxForm form = new MessageBoxForm (owner, text, caption, buttons,
645                                                                   icon, defaultButton, MessageBoxOptions.DefaultDesktopOnly, false);
646                                 
647                         return form.RunDialog ();
648                 }
649
650                 public static DialogResult Show (string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
651                                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options)
652                 {
653                         MessageBoxForm form = new MessageBoxForm (null, text, caption, buttons,
654                                                                   icon, defaultButton, options, false);
655                                 
656                         return form.RunDialog ();
657                 }
658
659                 public static DialogResult Show (IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
660                                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options)
661                 {
662                         MessageBoxForm form = new MessageBoxForm (owner, text, caption, buttons,
663                                                                   icon, defaultButton, options, false);
664                                 
665                         return form.RunDialog ();
666                 }
667                 #endregion      // Public Static Methods
668
669                 public static DialogResult Show (string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
670                                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options,
671                                                  bool displayHelpButton)
672                 {
673                         MessageBoxForm form = new MessageBoxForm (null, text, caption, buttons,
674                                                                   icon, defaultButton, options, displayHelpButton);
675                         return form.RunDialog ();
676                 }
677                 
678                 [MonoTODO ("Help is not implemented")]
679                 public static DialogResult Show (string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
680                                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options,
681                                                  string helpFilePath)
682                 {
683                         MessageBoxForm form = new MessageBoxForm (null, text, caption, buttons,
684                                                                   icon, defaultButton, options, true);
685                         form.SetHelpData (helpFilePath, null, HelpNavigator.TableOfContents, null);
686                         return form.RunDialog ();
687                 }
688                 
689                 [MonoTODO ("Help is not implemented")]
690                 public static DialogResult Show (string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
691                                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options,
692                                                  string helpFilePath, string keyword)
693                 {
694                         MessageBoxForm form = new MessageBoxForm (null, text, caption, buttons,
695                                                                   icon, defaultButton, options, true);
696                         form.SetHelpData (helpFilePath, keyword, HelpNavigator.TableOfContents, null);
697                         return form.RunDialog ();
698                 }
699                 
700                 [MonoTODO ("Help is not implemented")]
701                 public static DialogResult Show (string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
702                                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options,
703                                                  string helpFilePath, HelpNavigator navigator)
704                 {
705                         MessageBoxForm form = new MessageBoxForm (null, text, caption, buttons,
706                                                                   icon, defaultButton, options, true);
707                         form.SetHelpData (helpFilePath, null, navigator, null);
708                         return form.RunDialog ();
709                 }
710                 
711                 [MonoTODO ("Help is not implemented")]
712                 public static DialogResult Show (string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
713                                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options,
714                                                  string helpFilePath, HelpNavigator navigator, object param)
715                 {
716                         MessageBoxForm form = new MessageBoxForm (null, text, caption, buttons,
717                                                                   icon, defaultButton, options, true);
718                         form.SetHelpData (helpFilePath, null, navigator, param);
719                         return form.RunDialog ();
720                 }
721                 
722                 [MonoTODO ("Help is not implemented")]
723                 public static DialogResult Show (IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
724                                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options,
725                                                  string helpFilePath)
726                 {
727                         MessageBoxForm form = new MessageBoxForm (owner, text, caption, buttons,
728                                                                   icon, defaultButton, options, true);
729                         form.SetHelpData (helpFilePath, null, HelpNavigator.TableOfContents, null);
730                         return form.RunDialog ();
731                 }
732                 
733                 [MonoTODO ("Help is not implemented")]
734                 public static DialogResult Show (IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
735                                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options,
736                                                  string helpFilePath, string keyword)
737                 {
738                         MessageBoxForm form = new MessageBoxForm (owner, text, caption, buttons,
739                                                                   icon, defaultButton, options, true);
740                         form.SetHelpData (helpFilePath, keyword, HelpNavigator.TableOfContents, null);
741                         return form.RunDialog ();
742                 }
743                 
744                 [MonoTODO ("Help is not implemented")]
745                 public static DialogResult Show (IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
746                                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options,
747                                                  string helpFilePath, HelpNavigator navigator)
748                 {
749                         MessageBoxForm form = new MessageBoxForm (owner, text, caption, buttons,
750                                                                   icon, defaultButton, options, true);
751                         form.SetHelpData (helpFilePath, null, navigator, null);
752                         return form.RunDialog ();
753                 }
754                 
755                 [MonoTODO ("Help is not implemented")]
756                 public static DialogResult Show (IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
757                                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options,
758                                                  string helpFilePath, HelpNavigator navigator, object param)
759                 {
760                         MessageBoxForm form = new MessageBoxForm (owner, text, caption, buttons,
761                                                                   icon, defaultButton, options, true);
762                         form.SetHelpData (helpFilePath, null, navigator, param);
763                         return form.RunDialog ();
764                 }
765         }
766 }
767