MessageBox 按钮 - 设置语言? [英] MessageBox buttons - set language?

查看:18
本文介绍了MessageBox 按钮 - 设置语言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您使用 MessageBox.Show() 时,您可以选择 MessageBoxButtons 可供选择.可用的按钮是一个枚举,并为您提供Yes No"、OK Cancel"等选项.

When you use MessageBox.Show() you have a selection of MessageBoxButtons to choose from. The buttons available are an enum, and give you options like "Yes No", "OK Cancel", etc.

例如,当我使用挪威语消息文本时,用户仍然会收到英文Yes No".

When I am using, for instance, Norwegian message text the user still gets the English "Yes No".

有没有办法更改按钮的文本(在 C# 中)以使语言正确?我可以覆盖文本,或者以某种方式设置当前语言环境,以便我可以使用Ja Nei"而不是Yes No"吗?

Is there a way to change the text of the buttons (in C#) so that the language is correct? Can I override the text, or set the current locale in some way so that I can have "Ja Nei" instead of "Yes No"?

我不想依赖在我的客户端安装 .NET 语言包.

I do not want to rely on installing a .NET language pack at my client.

推荐答案

.NET 中没有对此的本地支持(据我所知,无论如何;如果我错了,请纠正我,任何人).我确实遇到了这篇 CodeProject 文章,它似乎通过一些消息挂钩和 P/Invoke 来解决问题:http://www.codeproject.com/KB/miscctrl/Localizing_MessageBox.aspx

There is no native support for this in .NET (as far as I know, anyway; please correct me if I'm wrong, anyone). I did come across this CodeProject article, that seem to do the trick with some message hooking and P/Invoke: http://www.codeproject.com/KB/miscctrl/Localizing_MessageBox.aspx

这篇关于MessageBox 按钮 - 设置语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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