c#中的 MessageBox 弹出提示框的用法

MessageBox.Show(<字符串str> Text, <字符串str> Title, <整型int> nType,MessageBoxIcon);

例:MessageBox.Show("计算结果是" + Convert.ToString( sum),"提醒",MessageBoxButtons.OKCancel,MessageBoxIcon.Information);

百科解释:

MessageBox.Show(Text,Title,MessageBoxButtons,MessageBoxIcon,MessageBoxDefaultButtons)

参数说明:

(1)Text:必选项,消息框的正文。

(2)Title:可选项,消息框的标题。

(3)MessageBoxButtons:可选项,消息框的按钮设置,默认只显示【确定】按钮。

OK――确定 OKCancel――确定和取消 AbortRetryIgnore――终止、重试和忽略

YesNoCancel――是、否和取消 YesNo――是和否 RetryCancel――重试和取消

(4)MessageBoxIcon:对话框中显示的图标样式,默认不显示任何图标。

Question――问号 Information、Asterisk――i号 Error、Stop、Hand――错误号

Warning、Exclamation――!号 None――不显示任何图标

(5)MessageBoxDefaultButtons:可选项,对话框中默认选中的按钮设置。

DefaultButton1――第1个button是默认按钮

DefaultButton2――第2个button是默认按钮

DefaultButton3――第3个button是默认按钮

备注:函数原型中蓝色字体部分的参数,可以通过点来获取其后面跟随的参数值。