1.
// 摘要:
// 显示具有指定文本的消息框。
//
// 参数:
// text:
// 要在消息框中显示的文本。
// 返回结果:
// System.Windows.Forms.DialogResult 值之一。
public static DialogResult Show(string text);
2.
// caption:
string text,string caption);
例子:MessageBox.Show("内容","标题");
3.
// buttons:
// System.Windows.Forms.MessageBoxButtons 值之一,可指定在消息框中显示哪些按钮。
// 异常:
// System.ComponentModel.InvalidEnumArgumentException:
// 指定的 buttons 参数不是 System.Windows.Forms.MessageBoxButtons 的成员。
// system.invalidOperationException:
// 试图在运行模式不是用户交互模式的进程中显示 System.Windows.Forms.MessageBox。这是由 System.Windows.Forms.System@R_526_404[email protected]teractive
// 属性指定的。
string caption,MessageBoxButtons buttons);
例子:MessageBox.Show("内容","标题",要在消息框中显示的按钮);
MessageBox.Show("内容",MessageBoxButtons.OK);
4.
// icon:
// System.Windows.Forms.MessageBoxIcon 值之一,它指定在消息框中显示哪个图标。
// 指定的 buttons 参数不是 System.Windows.Forms.MessageBoxButtons 的成员。- 或 - 指定的 icon
// 参数不是 System.Windows.Forms.MessageBoxIcon 的成员。
MessageBoxButtons buttons,1)">MessageBoxIcon icon);
例子:MessageBox.Show("内容",MessageBox.Button,按钮,MessageBox.Icon.图标);
MessageBox.Show("内容",MessageBoxButtons.OK,MessageBoxIcon.Warning);
5.
// 显示具有指定文本、标题、按钮、图标和默认按钮的消息框。
// defaultButton:
// buttons 不是 System.Windows.Forms.MessageBoxButtons 的成员。- 或 - icon 不是 System.Windows.Forms.MessageBoxIcon
// 的成员。- 或 - defaultButton 不是 System.Windows.Forms.MessageBoxDefaultButton 的成员。
MessageBoxIcon icon,1)">MessageBoxDefaultButton defaultButton);
//MessageBox.Show("内容",要显示的按钮,要显示的图标,设置默认按钮);
MessageBox.Show("内容",MessageBoxIcon.Warning,MessageBoxDefaultButton.Button1);
6.
// 显示具有指定文本、标题、按钮、图标、默认按钮和选项的消息框。
// System.Windows.Forms.MessageBoxDefaultButton 值之一,可指定消息框中的默认按钮。
// options:
// System.Windows.Forms.MessageBoxOptions 值之一,可指定将对消息框使用哪些显示和关联选项。若要使用默认值,请传入
// 0。
// 的成员。- 或 - 指定的 defaultButton 不是 System.Windows.Forms.MessageBoxDefaultButton
// 的成员。
// System.ArgumentException:
// options 同时指定了 System.Windows.Forms.MessageBoxOptions.DefaultDesktopOnly 和
// System.Windows.Forms.MessageBoxOptions.ServiceNotification。- 或 - buttons
// 指定了无效的 System.Windows.Forms.MessageBoxButtons 组合。
MessageBoxDefaultButton defaultButton,1)">MessageBoxOptions options);
7.
// 使用指定的帮助文件、HelpNavigator 和帮助主题显示一个具有指定文本、标题、按钮、图标、默认按钮、选项和"帮助"按钮的消息框。
// helpFilePath:
// 用户单击"帮助"按钮时显示的"帮助"文件的路径和名称。
// navigator:
// System.Windows.Forms.HelpNavigator 值之一。
// param:
MessageBoxOptions options,1)">string helpFilePath,1)">HelpNavigator navigator,1)">object param);
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。