C#中MessageBox.Show()方法详解
1.
// 摘要:
// 显示具有指定文本的消息框。
//
// 参数:
// text:
// 要在消息框中显示的文本。
//
// 返回结果:
// System.Windows.Forms.DialogResult 值之一。
public static DialogResult Show(string text);
例子:MessageBox.Show("内容");
2.
// 摘要:
// 显示具有指定文本和标题的消息框。
//
// 参数:
// text:
// 要在消息框中显示的文本。
//
// caption:
// 要在消息框的标题栏中显示的文本。
//
// 返回结果:
// System.Windows.Forms.DialogResult 值之一。
public static DialogResult Show(string text, string caption);
例子:MessageBox.Show("内容","标题");
3.
// 摘要:
// 显示具有指定文本、标题和按钮的消息框。
//
// 参数:
// text:
// 要在消息框中显示的文本。
//
// caption:
// 要在消息框的标题栏中显示的文本。
//
// buttons:
// System.Windows.Forms.MessageBoxButtons 值之一,可指定在消息框中显示哪些按钮。
//
// 返回结果:
// System.Windows.Forms.DialogResult 值之一。
//
// 异常:
// System.ComponentModel.InvalidEnumArgumentException:
// 指定的 buttons 参数不是 System.Windows.Forms.MessageBoxButtons 的成员。
//
// System.InvalidOperationException:
// 试图在运行模式不是用户交互模式的进程中显示 System.Windows.Forms.MessageBox。这是由 System.Windows.Forms.SystemInformation.UserInteractive
// 属性指定的。
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons);
例子:MessageBox.Show("内容","标题",要在消息框中显示的按钮);
MessageBox.Show("内容", "标题", MessageBoxButtons.OK);
4.
//
// 摘要:
// 显示具有指定文本、标题、按钮和图标的消息框。
//
// 参数:
// text:
// 要在消息框中显示的文本。
//
// caption:
// 要在消息框的标题栏中显示的文本。
//
// buttons:
// System.Windows.Forms.MessageBoxButtons 值之一,可指定在消息框中显示哪些按钮。
//
// icon:
// System.Windows.Forms.MessageBoxIcon 值之一,它指定在消息框中显示哪个图标。
//
// 返回结果:
// System.Windows.Forms.DialogResult 值之一。
//
// 异常:
// System.ComponentModel.InvalidEnumArgumentException:
// 指定的 buttons 参数不是 System.Windows.Forms.MessageBoxButtons 的成员。- 或 - 指定的 icon
// 参数不是 System.Windows.Forms.MessageBoxIcon 的成员。
//
// System.InvalidOperationException:
// 试图在运行模式不是用户交互模式的进程中显示 System.Windows.Forms.MessageBox。这是由 System.Windows.Forms.SystemInformation.UserInteractive
// 属性指定的。
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon);
例子:MessageBox.Show("内容","标题",MessageBox.Button,按钮,MessageBox.Icon.图标);
MessageBox.Show("内容", "标题", MessageBoxButtons.OK,MessageBoxIcon.Warning);
5.
// 摘要:
// 显示具有指定文本、标题、按钮、图标和默认按钮的消息框。
//
// 参数:
// text:
// 要在消息框中显示的文本。
//
// caption:
// 要在消息框的标题栏中显示的文本。
//
// buttons:
// System.Windows.Forms.MessageBoxButtons 值之一,可指定在消息框中显示哪些按钮。
//
// icon:
// System.Windows.Forms.MessageBoxIcon 值之一,它指定在消息框中显示哪个图标。
//
// defaultButton:
//
// 返回结果:
// System.Windows.Forms.DialogResult 值之一。
//
// 异常:
// System.ComponentModel.InvalidEnumArgumentException:
// buttons 不是 System.Windows.Forms.MessageBoxButtons 的成员。- 或 - icon 不是 System.Windows.Forms.MessageBoxIcon
// 的成员。- 或 - defaultButton 不是 System.Windows.Forms.MessageBoxDefaultButton 的成员。
//
// System.InvalidOperationException:
// 试图在运行模式不是用户交互模式的进程中显示 System.Windows.Forms.MessageBox。这是由 System.Windows.Forms.SystemInformation.UserInteractive
// 属性指定的。
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton);
//MessageBox.Show("内容", "标题", 要显示的按钮,要显示的图标,设置默认按钮);
//设置第一个按钮为默认按钮,代码如下:
MessageBox.Show("内容", "标题", MessageBoxButtons.OK,MessageBoxIcon.Warning,MessageBoxDefaultButton.Button1);
6.
//
// 摘要:
// 显示具有指定文本、标题、按钮、图标、默认按钮和选项的消息框。
//
// 参数:
// text:
// 要在消息框中显示的文本。
//
// caption:
// 要在消息框的标题栏中显示的文本。
//
// buttons:
// System.Windows.Forms.MessageBoxButtons 值之一,可指定在消息框中显示哪些按钮。
//
// icon:
// System.Windows.Forms.MessageBoxIcon 值之一,它指定在消息框中显示哪个图标。
//
// defaultButton:
// System.Windows.Forms.MessageBoxDefaultButton 值之一,可指定消息框中的默认按钮。
//
// options:
// System.Windows.Forms.MessageBoxOptions 值之一,可指定将对消息框使用哪些显示和关联选项。若要使用默认值,请传入
// 0。
//
// 返回结果:
// System.Windows.Forms.DialogResult 值之一。
//
// 异常:
// System.ComponentModel.InvalidEnumArgumentException:
// buttons 不是 System.Windows.Forms.MessageBoxButtons 的成员。- 或 - icon 不是 System.Windows.Forms.MessageBoxIcon
// 的成员。- 或 - 指定的 defaultButton 不是 System.Windows.Forms.MessageBoxDefaultButton
// 的成员。
//
// System.InvalidOperationException:
// 试图在运行模式不是用户交互模式的进程中显示 System.Windows.Forms.MessageBox。这是由 System.Windows.Forms.SystemInformation.UserInteractive
// 属性指定的。
//
// System.ArgumentException:
// options 同时指定了 System.Windows.Forms.MessageBoxOptions.DefaultDesktopOnly 和
// System.Windows.Forms.MessageBoxOptions.ServiceNotification。- 或 - buttons
// 指定了无效的 System.Windows.Forms.MessageBoxButtons 组合。
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options);
7.
//
// 摘要:
// 使用指定的帮助文件、HelpNavigator 和帮助主题显示一个具有指定文本、标题、按钮、图标、默认按钮、选项和"帮助"按钮的消息框。
//
// 参数:
// text:
// 要在消息框中显示的文本。
//
// caption:
// 要在消息框的标题栏中显示的文本。
//
// buttons:
// System.Windows.Forms.MessageBoxButtons 值之一,可指定在消息框中显示哪些按钮。
//
// icon:
// System.Windows.Forms.MessageBoxIcon 值之一,它指定在消息框中显示哪个图标。
//
// defaultButton:
// System.Windows.Forms.MessageBoxDefaultButton 值之一,可指定消息框中的默认按钮。
//
// options:
// System.Windows.Forms.MessageBoxOptions 值之一,可指定将对消息框使用哪些显示和关联选项。若要使用默认值,请传入
// 0。
//
// helpFilePath:
// 用户单击"帮助"按钮时显示的"帮助"文件的路径和名称。
//
// navigator:
// System.Windows.Forms.HelpNavigator 值之一。
//
// param:
// 用户单击"帮助"按钮时显示的帮助主题的数值 ID。
//
// 返回结果:
// System.Windows.Forms.DialogResult 值之一。
//
// 异常:
// System.ComponentModel.InvalidEnumArgumentException:
// buttons 不是 System.Windows.Forms.MessageBoxButtons 的成员。- 或 - icon 不是 System.Windows.Forms.MessageBoxIcon
// 的成员。- 或 - 指定的 defaultButton 不是 System.Windows.Forms.MessageBoxDefaultButton
// 的成员。
//
// System.InvalidOperationException:
// 试图在运行模式不是用户交互模式的进程中显示 System.Windows.Forms.MessageBox。这是由 System.Windows.Forms.SystemInformation.UserInteractive
// 属性指定的。
//
// System.ArgumentException:
// options 同时指定了 System.Windows.Forms.MessageBoxOptions.DefaultDesktopOnly 和
// System.Windows.Forms.MessageBoxOptions.ServiceNotification。- 或 - buttons
// 指定了无效的 System.Windows.Forms.MessageBoxButtons 组合。
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, string helpFilePath, HelpNavigator navigator, object param);
C#中MessageBox.Show()方法详解的更多相关文章
- C# WinForm 中 MessageBox的使用详解
1.C# WinForm 中 MessageBox的使用详解:http://www.cnblogs.com/bq-blog/archive/2012/07/27/2611810.html
- Java中的main()方法详解
在Java中,main()方法是Java应用程序的入口方法,也就是说,程序在运行的时候,第一个执行的方法就是main()方法,这个方法和其他的方法有很大的不同,比如方法的名字必须是main,方法必须是 ...
- Python 在子类中调用父类方法详解(单继承、多层继承、多重继承)
Python 在子类中调用父类方法详解(单继承.多层继承.多重继承) by:授客 QQ:1033553122 测试环境: win7 64位 Python版本:Python 3.3.5 代码实践 ...
- Python中格式化format()方法详解
Python中格式化format()方法详解 Python中格式化输出字符串使用format()函数, 字符串即类, 可以使用方法; Python是完全面向对象的语言, 任何东西都是对象; 字符串的参 ...
- (转)shell中test命令方法详解
test命令用法.功能:检查文件和比较值 shell中test命令方法详解 原文:https://www.cnblogs.com/guanyf/p/7553940.html 1)判断表达式 if te ...
- 关于 redux-saga 中 take 使用方法详解
本文介绍了关于redux-saga中take使用方法详解,分享给大家,具体如下: 带来一个自己研究好久的API使用方法. redux-saga中effect中take这个API使用方式,用的多的是ca ...
- JavaScript中数组Array方法详解
ECMAScript 3在Array.prototype中定义了一些很有用的操作数组的函数,这意味着这些函数作为任何数组的方法都是可用的. 1.Array.join()方法 Array.join()方 ...
- jquery中的ajax方法详解
定义和用法ajax() 方法通过 HTTP 请求加载远程数据.该方法是 jQuery 底层 AJAX 实现.简单易用的高层实现见 $.get, $.post 等.$.ajax() 返回其创建的 XML ...
- Laravel框架中的make方法详解
为什么网上已经有这么多的介绍Laravel的执行流程了,Laravel的容器详解了,Laravel的特性了,Laravel的启动过程了之类的文章,我还要来再分享呢? 因为,每个人的思维方式和方向是不一 ...
随机推荐
- (转)Sublime Text中文乱码问题
Sublime Text 2是一个非常不错的源代码及文本编辑器,但是不支持GB2312和GBK编码在很多情况下会非常麻烦.不过Sublime Package Control所以供的插件可以让Subli ...
- PHP通过phpmailer批量发送邮件功能
前端页面代码: 注意:目前发送人使用的qq邮箱支持的不是特别友好.建议使用网易 新浪 163等其他邮箱. 需要用到phpmailer包 下载地址:https://sourceforge.net/pro ...
- 安装完ubuntu16.4.0之后要做的一些优化
1.删除libreoffice libreoffice虽然是开源的,但是Java写出来的office执行效率实在不敢恭维,装完系统后果断删掉 sudo apt-get remove libreoffi ...
- ubuntu下使用 chkconfig 是一种习惯
ubuntu下使用 chkconfig 是一种习惯 习惯了chkconfig命令, 闲来写了个脚本模拟下, 步骤很简单. 如下: 第一步, 安装sysv-rc-conf sudo apt instal ...
- ExtJs的expand和collapse
最近在研究ExtJs的窗口组件(Ext.window),关于扩展显示expand和折叠显示collapse的一点心得记录一下,以便后查. var win2 = new Ext.window({ id ...
- 灵玖软件NLPIRParser智能文本聚类
随着互联网的迅猛发展,信息的爆炸式增加,信息超载问题变的越来越严重,信息的更新率也越来越高,用户在信息海洋里查找信息就像大海捞针一样.搜索引擎服务应运而生,在一定程度上满足了用户查找信息的需要.然而互 ...
- echarts_部分图表配置_dataZoom精确控制显示数据数量
echarts为我们提供了dataZoom组件,当数据过多时就有了它的用武之地,业务场景:数据返回100调可是为了前端显示效果默认只显示20条,其他数据由dataZoom控制显示隐藏: functio ...
- ABP+AdminLTE+Bootstrap Table权限管理系统第二节--数据库脚本
第一点,上一篇文章中我们讲到codefirst中一些问题包括如图 1,codefirst在执行的数据库迁移过程中产生了很多文件,对于强迫症的我而言特别不爽,这些是可以不用生成的啊 2,在codefir ...
- PIVOT行转列
PIVOT通过将表达式某一列中的唯一值转换为输出中的多个列来旋转表值表达式,并在必要时对最终输出中所需的任何其余列值执行聚合. 测试数据 INSERT INTO [TestRows2Columns] ...
- java多线程系列(五)---synchronized ReentrantLock volatile Atomic 原理分析
java多线程系列(五)---synchronized ReentrantLock volatile Atomic 原理分析 前言:如有不正确的地方,还望指正. 目录 认识cpu.核心与线程 java ...