MessageBox

MessageBox

System. Windows .Forms (system. windows .forms.dll) class

This class provides a simple means to display a modal pop-up box with a title, message, and icon, and obtain some basic Yes/No, OK/Cancel information from the user . It is essentially a wrapper around the Win32 MessageBox() method.

You can Show() a message, which returns the DialogResult indicating which button the end user clicked. When showing the message, you can specify the title and body text, the MessageBoxButtons to show (and which button is the MessageBoxDefaultButton ), the MessageBoxIcon , and some MessageBoxOptions that deal with right-to-left mode, multiple desktop alignment, and alignment.

Don't forget that popping up a message box is highly intrusive , forcibly interrupting a users workflow. You might consider ErrorProvider , or even a ToolTip , as a better way of notifying the user of problems.

 public class  MessageBox  {  // Public Static Methods  public static DialogResult  Show  (IWin32Window  owner  , string  text  );    public static DialogResult  Show  (IWin32Window  owner  , string  text  , string  caption  );    public static DialogResult  Show  (IWin32Window  owner  , string  text  , string  caption  , MessageBoxButtons  buttons  );    public static DialogResult  Show  (IWin32Window  owner  , string  text  , string  caption  , MessageBoxButtons  buttons  ,          MessageBoxIcon  icon  );    public static DialogResult  Show  (IWin32Window  owner  , string  text  , string  caption  , MessageBoxButtons  buttons  ,          MessageBoxIcon  icon  , MessageBoxDefaultButton  defaultButton  );    public static DialogResult  Show  (IWin32Window  owner  , string  text  , string  caption  , MessageBoxButtons  buttons  ,          MessageBoxIcon  icon  , MessageBoxDefaultButton  defaultButton  , MessageBoxOptions  options  );    public static DialogResult  Show  (string  text  );    public static DialogResult  Show  (string  text  , string  caption  );    public static DialogResult  Show  (string  text  , string  caption  , MessageBoxButtons  buttons  );    public static DialogResult  Show  (string  text  , string  caption  , MessageBoxButtons  buttons  , MessageBoxIcon  icon  );    public static DialogResult  Show  (string  text  , string  caption  , MessageBoxButtons  buttons  , MessageBoxIcon  icon  ,         MessageBoxDefaultButton  defaultButton  );    public static DialogResult  Show  (string  text  , string  caption  , MessageBoxButtons  buttons  , MessageBoxIcon  icon  ,          MessageBoxDefaultButton  defaultButton  , MessageBoxOptions  options  ); } 


. Net Windows Forms in a Nutshell
.NET Windows Forms in a Nutshell
ISBN: 0596003382
EAN: 2147483647
Year: 2002
Pages: 794

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net