您现在的位置是:首页» windows系统» c语言messagebox怎么用,c语言中messagebox怎么运行

c语言messagebox怎么用,c语言中messagebox怎么运行

2023-12-05 03:19:04
今天小编为大家分享Windows系统下载、Windows系统教程、windows相关应用程序的文章,希望能够帮助到大家! 1、MessageBox.Show("提示内容!","提示窗口标题!", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question,

今天小编为大家分享Windows系统下载、Windows系统教程、windows相关应用程序的文章,希望能够帮助到大家!

1、MessageBox.Show("提示内容!","提示窗口标题!", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1,MessageBoxOptions.RtlReading);

2、其中,前两个已经已经说明下面说:

3、MessageBoxButtons选择MessageBox所需要的按钮(确定/取消……等等)

4、MessageBoxIcon选择本提示框所提示信息的类型图标(疑问就选择Question,警告信息就选择Warning等)

5、MessageBoxDefaultButton选择默认选中的按钮(按顺序,Button1为MessageBox上的第一个按钮)

6、MessageBoxOptions选择MessageBox上按钮或文本的的排列格式(一般用不到,柯以不要此项……)

1、使用System.Collections.Generic;

2、使用System.Windows.Forms的;#地区无效button_Click(对象发件人,发送System.EventArgs){字符串inMsg= InputSystem.InputBox.ShowInputBox(“输入框”,“输入信息”,的String.Empty);//对用户的输入信息进行检查,如果(inMsg.Trim()=的String.Empty)的MessageBox.show(inMsg!);其他的MessageBox.show(“输入为空”);}*/#endregion空间UVCE{///<摘要>///输入框的摘要说明///</摘要>公共类输入框:System.Windows.Forms.Form中{私人System.Windows.Forms.Label label_Info;私人文本框textBox_Data;个人按钮button_Enter;个人按钮button_Esc;私人System.ComponentModel.Container成分= NULL;私人输入框(){的InitializeComponent(); this.TopMost= TRUE;//this.StartPosition= FormStartPosition.CenterScreen;//inputbox.Location.X= 0; inputbox.Location.Y= 0;//inputbox.StartPosition= FormStartPosition.CenterScreen;//inputbox.Left= 0;//inputbox.Top= 0;}保护覆盖无效的Dispose(BOOL处置){如果(处置){如果(!组件= NULL){ components.Dispose();}} base.Dispose(处置);}私人无效的InitializeComponent(){ this.label_Info=新System.Windows.Forms.Label(); this.textBox_Data=新系统.Windows.Forms.TextBox(); this.button_Enter=新System.Windows.Forms.Button(); this.button_Esc=新System.Windows.Forms.Button(); this.SuspendLayout();//// label_Info// this.label_Info.BackColor= System.Drawing.SystemColors.ButtonFace; this.label_Info.FlatStyle= System.Windows.Forms.FlatStyle.System; this.label_Info.Font=新System.Drawing.Font(“宋体”,9F,System.Drawing.FontStyle.Regular,System.Drawing.GraphicsUnit.Point,((字节)(134))); this.label_Info.ForeColor= System.Drawing.Color.Gray; this.label_Info.Location=新的系统。 Drawing.Point(10,35); this.label_Info.Name=“label_Info”; this.label_Info.Size=新System.Drawing.Size(147,46); this.label_Info.TabIndex= 1; this.label_Info.Text=“[Enter]键确认| [Esc]键取消”; this.label_Info.TextAlign= System.Drawing.ContentAlignment.MiddleLeft;//// textBox_Data// this.textBox_Data.Location=新System.Drawing.Point(7,7); this.textBox_Data.Name=“textBox_Data”; this.textBox_Data.Size=新System.Drawing.Size(191,20); this.textBox_Data.TabIndex= 2; this.textBox_Data.KeyDown+=新System.Windows。 Forms.KeyEventHandler(this.textBox_Data_KeyDown);//// button_Enter// this.button_Enter.Location=新System.Drawing.Point(162,40); this.button_Enter.Name=“button_Enter”; this.button_Enter.Size=新System.Drawing.Size(42,18); this.button_Enter.TabIndex= 3; this.button_Enter.Text=“确认”; this.button_Enter.UseVisualStyleBackColor= TRUE; this.button_Enter.Click+=新System.EventHandler(this.button_Enter_Click);//// button_Esc// this.button_Esc.Location=新System.Drawing.Point(162,64); this.button_Esc.Name=“button_Esc”; this.button_Esc.Size=新的系统。 Drawing.Size(42,19); this.button_Esc.TabIndex= 4; this.button_Esc.Text=“取消”; this.button_Esc.UseVisualStyleBackColor= TRUE; this.button_Esc.Click+=新System.EventHandler(这一点。 button_Esc_Click);////的InputBox// this.AutoScaleBaseSize=新System.Drawing.Size(5,13); this.ClientSize=新System.Drawing.Size(250,= System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox= FALSE; this.MinimizeBox= FALSE; this.Name=“输入框”; this.Text=“输入框”; this.Load+=新无效textBox_Data_KeyDown(对象发件人,KeyEventArgs E){如果(e.KeyCode== Keys.Enter){button_Enter_Click(发件人,E);}否则,如果(e.KeyCode== Keys.Escape){button_Esc_Click(发件人,E);}}私人无效button_Enter_Click(对象发件人,EventArgs五){ this.Close();}私人无效button_Esc_Click(对象发件人,EventArgs五){ textBox_Data.Text=的String.Empty; this.Close();}//显示输入框公共静态字符串ShowInputBox(INT左,INT顶部,串标题,提示字符串,字符串DefaultResponse){输入框输入框=新的输入框();如果(!Title.Trim()=的String.Empty)inputbox.Text=标题;如果( Prompt.Trim()=的String.Empty)inputbox.label_Info.Text=提示;!如果(DefaultResponse.Trim()=的String.Empty)inputbox.textBox_Data.Text= DefaultResponse;! inputbox.ShowDialog(); inputbox.Left=左; inputbox.Top=顶部;返回inputbox.textBox_Data.Text;}公共静态字符串ShowInputBox(FormStartPosition位置,标题字符串,字符串提示,串DefaultResponse){输入框输入框=新的输入框(); inputbox.StartPosition=位置;如果( Title.Trim()=的String.Empty)inputbox.Text=标题;!如果(Prompt.Trim()=的String.Empty)inputbox.label_Info.Text=提示;!!如果(DefaultResponse.Trim()=的String.Empty)inputbox.textBox_Data.Text= DefaultResponse; inputbox.ShowDialog();返回inputbox.textBox_Data.Text;}公共静态字符串ShowInputBox(){返回ShowInputBox(FormStartPosition.CenterScreen,的String.Empty,的String.Empty,的String.Empty);}公共静态字符串ShowInputBox(字符串名称){返回ShowInputBox(FormStartPosition.CenterScreen,标题,的String.Empty,的String.Empty);}公共静态字符串ShowInputBox(字符串名称,字符串提示){返回ShowInputBox(FormStartPosition.CenterScreen,标题,及时,的String.Empty);}公共静态字符串ShowInputBox(字符串名称,字符串提示,串DefaultResponse){返回ShowInputBox(FormStartPosition.CenterScreen,标题,提示,DefaultResponse);}私人无效InputBox_Load(对象发件人,EventArgs的){}}}

wwW.Xtw.Com.cN系统网专业的PC、手机系统开发下载平台,HarmonyOS系统、安卓、OS、windows电脑重装系统在线下载安装,操作系统平台技术学习,攻略教程,技术交流。

免责声明:本文中引用的各种信息及资料(包括但不限于文字、数据、图表及超链接等)均来源于该信息及资料的相关主体(包括但不限于公司、媒体、协会等机构)的官方网站或公开发表的信息。内容仅供参考使用,不准确地方联系删除处理!

联系邮箱:773537036@qq.com

标签: 请问 方法 show