收藏 分销(赏)

Messagebox.Show常用参数.doc

上传人:仙人****88 文档编号:9458383 上传时间:2025-03-27 格式:DOC 页数:10 大小:138.04KB
下载 相关 举报
Messagebox.Show常用参数.doc_第1页
第1页 / 共10页
Messagebox.Show常用参数.doc_第2页
第2页 / 共10页
点击查看更多>>
资源描述
private void button1_Click(object sender, EventArgs e)         {             MessageBox.Show("  1  个参数 "                 );         }                                                     private void button2_Click(object sender, EventArgs e)         {             MessageBox.Show(" 2 个参数。。 ",                                  "亮仔提示"                                  );         }                                                     private void button3_Click(object sender, EventArgs e)         {             MessageBox.Show(" 3 个参数。。。 ",                                 " 亮仔提示",                                 MessageBoxButtons.YesNoCancel                                 );         }                                                      private void button4_Click(object sender, EventArgs e)         {             MessageBox.Show(" 4 个参数。。。  ",                                 " 亮仔提示",                                 MessageBoxButtons.OKCancel,                                 MessageBoxIcon.Warning                                 );         }                                                         private void button5_Click(object sender, EventArgs e)         {             MessageBox.Show(" 5 个参数。。 。  ",                                 " 亮仔提示",                                 MessageBoxButtons.OKCancel,                                 MessageBoxIcon.Warning,                                 MessageBoxDefaultButton.Button2                                 );         }                                                         private void button6_Click(object sender, EventArgs e)         {             MessageBox.Show(" 6 个参数。。。  ",                                 " 亮仔提示",                                 MessageBoxButtons.OKCancel,                                 MessageBoxIcon.Warning,                                 MessageBoxDefaultButton.Button2,                                 MessageBoxOptions.RtlReading      //ServiceNotification//.RightAlign   // 标题向右对齐。                                 );         }                                                       private void button7_Click(object sender, EventArgs e)         {             MessageBox.Show(" 7 个参数。。帮助菜单不可用。。。。。  ",                                 " 亮仔提示",                                 MessageBoxButtons.OKCancel,                                 MessageBoxIcon.Warning,                                 MessageBoxDefaultButton.Button2,                                 MessageBoxOptions.RightAlign,                                 true   // 标题向右对齐。。。。。                                );         }                                                         private void button8_Click(object sender, EventArgs e)         {             MessageBox.Show(" 7 个参数。帮助菜单    可用。   ",                                 " 亮仔提示",                                 MessageBoxButtons.OKCancel,                                 MessageBoxIcon.Warning,                                 MessageBoxDefaultButton.Button2,                                MessageBoxOptions.RightAlign  ,   // 要使用默认风格,此处参数可设为 0                                     @"C:\Documents and Settings\Administrator\桌面\新建文本文档.txt"                                 );         }                                       1.     1个参数。  MessageBox.Show(string text); //     显示具有指定文本的消息框。 // 参数:text:     要在消息框中显示的文本。 // 返回结果:     System.Windows.Forms.DialogResult 值之一。   2.     2个参数。 MessageBox.Show(string text, string caption); //     显示具有指定文本和标题的消息框。 // 参数: //   text:      要在消息框中显示的文本。 //   caption:     要在消息框的标题栏中显示的文本。 // 返回结果:      System.Windows.Forms.DialogResult 值之一。   3.     3个参数。  MessageBox.Show(string text, string caption, MessageBoxButtons buttons); //     显示具有指定文本、标题和按钮的消息框。 // 参数: //   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 属性指定的。   4.     4个参数。 MessageBox.Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon); //     显示具有指定文本、标题、按钮和图标的消息框。 // 参数: //   text:     要在消息框中显示的文本。 //   caption:     要在消息框的标题栏中显示的文本。 //   buttons:     System.Windows.Forms.MessageBoxButtons 值之一,可指定在消息框中显示哪些按钮。 //   icon:     System.Windows.Forms.MessageBoxIcon 值之一,它指定在消息框中显示哪个图标。 // 返回结果:     System.Windows.Forms.DialogResult 值之一。 // 异常: //   System.ComponentModel.InvalidEnumArgumentException:     指定的 buttons 参数不是 System.Windows.Forms.MessageBoxButtons 的成员。- 或 - 指定的 icon24参数不是 System.Windows.Forms.MessageBoxIcon 的成员。 //   System.InvalidOperationException:     试图在运行模式不是用户交互模式的进程中显示 System.Windows.Forms.MessageBox。这是由 System.Windows.Forms.SystemInformation.UserInteractive属性指定的。           5.     5个参数。  MessageBox.Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton); //     显示具有指定文本、标题、按钮、图标和默认按钮的消息框。 // 参数: //   text:      要在消息框中显示的文本。 //   caption:     要在消息框的标题栏中显示的文本。 //   buttons:     System.Windows.Forms.MessageBoxButtons 值之一,可指定在消息框中显示哪些按钮。 //   icon:     System.Windows.Forms.MessageBoxIcon 值之一,它指定在消息框中显示哪个图标。 //   default Button:     System.Windows.Forms.MessageBoxDefaultButton 值之一,可指定消息框中的默认按钮。 // 返回结果:     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属性指定的。   6.     6个参数。 MessageBox.Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,MessageBoxDefaultButton defaultButton, MessageBoxOptions options); //     显示具有指定文本、标题、按钮、图标、默认按钮和选项的消息框。 // 参数: //   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。- 或 - buttons42指定了无效的System.Windows.Forms.MessageBoxButtons 组合。   7.     7个参数一。 MessageBox.Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,MessageBoxDefaultButton defaultButton, MessageBoxOptions options, bool displayHelpButton); //     显示一个具有指定文本、标题、按钮、图标、默认按钮、选项和“帮助”按钮的消息框。 // 参数: //   text:      要在消息框中显示的文本。 //   caption:     要在消息框的标题栏中显示的文本。 //   buttons:     System.Windows.Forms.MessageBoxButtons 值之一,可指定在消息框中显示哪些按钮。 //   icon:     System.Windows.Forms.MessageBoxIcon 值之一,它指定在消息框中显示哪个图标。 //   defaultButton:     System.Windows.Forms.MessageBoxDefaultButton 值之一,可指定消息框中的默认按钮。 //   options:     System.Windows.Forms.MessageBoxOptions 值之一,可指定将对消息框使用哪些显示和关联选项。若要使用默认值,请传入0。 //   helpButton:     如果显示“帮助”按钮,则为 true;否则为 false。默认为 false。 // 返回结果:     System.Windows.Forms.DialogResult 值之一。 // 异常:34         //   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 组合。       8.  7个参数二 MessageBox.Show(string text, string caption, MessageBoxButtons buttons,MessageBoxIcon icon, MessageBoxDefaultButton defaultButton,MessageBoxOptions options, string helpFilePath); //     使用指定的帮助文件显示一个具有指定文本、标题、按钮、图标、默认按钮、选项和“帮助”按钮的消息框。 // 参数: //   text:     要在消息框中显示的文本。 //   caption:     要在消息框的标题栏中显示的文本。 //   buttons:     System.Windows.Forms.MessageBoxButtons 值之一,可指定在消息框中显示哪些按钮。 //   icon:     System.Windows.Forms.MessageBoxIcon 值之一,它指定在消息框中显示哪个图标。 //   defaultButton:     System.Windows.Forms.MessageBoxDefaultButton 值之一,可指定消息框中的默认按钮。 //   options:     System.Windows.Forms.MessageBoxOptions 值之一,可指定将对消息框使用哪些显示和关联选项。若要使用默认值,请传入0。 //   helpFilePath:     用户单击“帮助”按钮时显示的“帮助”文件的路径和名称。 // 返回结果:     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 组合。   
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传
相似文档                                   自信AI助手自信AI助手

当前位置:首页 > 教育专区 > 小学其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:4009-655-100  投诉/维权电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服