MessageBox buttons - set language?(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 按钮 - 设置语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MessageBox 按钮 - 设置语言?


基础教程推荐
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01