如何在C#中更改消息框按钮名称? [英] How do I change the Message Box Buttons Name in C#?

查看:417
本文介绍了如何在C#中更改消息框按钮名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我需要更改消息框按钮确定并取消文本更新和添加新内容?

是否可以在C#.NET或者我需要创建一个表单并自定义它?

请帮助我。

Hi all,

I need to change the Message Box Buttons Ok and Cancel Text to Update and AddNew?
Is it possible in C#.NET or I need to create a form and customize it?
Kindly help me in this.

推荐答案

你可能需要添加表格,查看下面的参考

http://stackoverflow.com/questions/4264664/how-to-change-button-text-for-yes-no-buttons-on-messagebox-show-dialog [ ^ ]
You might need to add a form, check bellow for reference
http://stackoverflow.com/questions/4264664/how-to-change-button-text-for-yes-no-buttons-on-messagebox-show-dialog[^]


试试这个例子。

try this example .
1. Open a new C# Windows Forms project in Visual Studio.

2. Open the Project Menu and then select Add Class.

3. At the bottom of the dialog box change the name of the file from class1.cs to MessageBoxManager.cs, press the Add button and then delete everything from the file that opens up.

4. Download the source code from the Code Project article, find MessageBoxManager.cs and copy and paste the code into the blank MessageBoxManager.cs file in Visual Studio.

5. Now open program.cs from Solution Explorer and change the Main() method so it looks like this:

        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            MessageBoxManager.OK = "Alright";
            MessageBoxManager.Cancel = "Noway";
            MessageBoxManager.Register();
            MessageBox.Show("This is a message...", "Test", MessageBoxButtons.OKCancel);
            Application.Run(new Form1());
            MessageBoxManager.Unregister();
        }

6. Finally, press F5 to start debugging and you should see a MessageBox pop with the custom text on the buttons, followed by a blank form to customize as you like.





看到这个链接..



本地化系统MessageBox [ ^ ]


这篇关于如何在C#中更改消息框按钮名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆