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 按钮 - 设置语言?
基础教程推荐
- 将数据集转换为列表 2022-01-01
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- 如果条件可以为空 2022-01-01
- 从 C# 控制相机设备 2022-01-01
- C# 9 新特性——record的相关总结 2023-04-03
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- 获取C#保存对话框的文件路径 2022-01-01
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
