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的启动过程了之类的文章,我还要来再分享呢? 因为,每个人的思维方式和方向是不一 ...
随机推荐
- (转)AJax跨域:No 'Access-Control-Allow-Origin' header is present on the requested resource
在本地用ajax跨域访问请求时报错: No 'Access-Control-Allow-Origin' header is present on the requested resource. Ori ...
- tensorflow 实现神经网络
import tensorflow as tf import numpy as np # 添加层 def add_layer(inputs, in_size, out_size, activation ...
- IDEA 单元测试testng入门及testng.xml
直接进入正题: 1.TestNG的运行方式如下: With a testng.xml file 直接run as test suite With ant 使用ant From the command ...
- ubuntu下使用 chkconfig 是一种习惯
ubuntu下使用 chkconfig 是一种习惯 习惯了chkconfig命令, 闲来写了个脚本模拟下, 步骤很简单. 如下: 第一步, 安装sysv-rc-conf sudo apt instal ...
- 大数据算法->推荐系统常用算法之基于内容的推荐系统算法
港真,自己一直非常希望做算法工程师,所以自己现在开始对现在常用的大数据算法进行不断地学习,今天了解到的算法,就是我们生活中无处不在的推荐系统算法. 其实,向别人推荐商品是一个很常见的现象,比如我用了一 ...
- log4go的日志滚动处理——适应生产环境的需要
日志处理有三类使用环境,开发环境DE,测试环境TE,生产环境PE. 前两类可以看成是一类,重要的是屏幕显示--termlog.生产环境中主要用的是socklog 和 filelog,即网络传输日志和文 ...
- 从 Vue 1.x 迁移 — Vue.js
闲聊: 又到周五啦,明天不用上班啦哈哈哈哈哈,想想就好开心啊,嘻嘻,小颖这周三的早晨做个一个美梦,把自己愣是笑醒了,梦的大概剧情我忘记了,总之宝宝是被笑醒的,行了之后还傻笑了一段时间,真希望每天早上都 ...
- 推荐60个jQuery插件(转)
jQuery插件jQuery Spin Button自定义文本框数值自增或自减 jQuery插件JQuery Pager分页器实现javascript分页功能 jQuery插件FontSizer实现J ...
- 是什么让javascript变得如此奇妙
What Makes Javascript Weird...and AWESOME -> First Class Functions -> Event-Driven Evironment ...
- CentOS编译PHP过程中常见错误信息的解决方法
原文链接:http://www.linuxidc.com/Linux/2014-05/102327.htm ********************************************** ...