Reader Level:
ARTICLE

Localizable Message Box Control

Posted by g_lazarevic Articles | Windows Controls C# April 02, 2005
This is localizable MessageBox control. Buttons on standard windows message box controls are always Yes, No, Abort, Cancel, OK, Ignore, Retry. I needed different text on my message boxes so I decided to develop custom message box control.
  • 0
  • 0
  • 15439
Download Files:
 

My control is useful for every project. This is localizable MessageBox control. Buttons on standard windows message box controls are always Yes, No, Abort, Cancel, OK, Ignore, Retry. I needed different text on my message boxes so I decided to develop custom message box control. I wrote one Test application just to show how it works. There are 10 predefined constructors.

  • 5 classic like Windows.Forms.MessageBox
    1. public static DialogResult Display(string message,string caption,MessageBoxButtons buttons,MessageBoxIcon icon,MessageBoxDefaultButton defaultButton)
    2. public static DialogResult Display(string message,string caption,MessageBoxButtons buttons,MessageBoxIcon icon)
    3. public static DialogResult Display(string message,string caption,MessageBoxButtons buttons)
    4. public static DialogResult Display(string message,string caption)
    5. public static DialogResult Display(string message)
  • 5 special with predefined text on buttons
    1. public static DialogResult DisplayLocal(string message,string caption,MessageBoxButtons buttons,MessageBoxIcon icon,MessageBoxDefaultButton defaultButton,string yesButtonText,string noButtonText,string abortButtonText)
    2. public static DialogResult DisplayLocal(string message,string caption,MessageBoxButtons buttons,MessageBoxIcon icon,string yesButtonText,string noButtonText,string abortButtonText)
    3. public static DialogResult DisplayLocal(string message,string caption,MessageBoxButtons buttons,string yesButtonText,string noButtonText,string abortButtonText)
    4. public static DialogResult DisplayLocal(string message,string caption,string yesButtonText)
    5. public static DialogResult DisplayLocal(string message,string yesButtonText)

Default text is Serbian Da=Yes, Ne=No and Odustani=Abort.
Dialog result is on of the following:

  • Yes
  • No
  • Cancel

There is no DialogResult.OK, DialogResult.OK, DialogResult.Retry

You can

  • Have maximum 3 buttons
  • Choose one of four Icons (Error, Information, Warning, Question, No icon)
  • Set default button
  • Set text for each button

Here are some screen shots to take a look at:

Example 1:

Example 2:

COMMENT USING

Trending up