MessageBox 按钮 - 设置语言?

12

本文介绍了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 按钮 - 设置语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

C# 中的多播委托奇怪行为?
Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)...
2023-11-11 C#/.NET开发问题
6

参数计数与调用不匹配?
Parameter count mismatch with Invoke?(参数计数与调用不匹配?)...
2023-11-11 C#/.NET开发问题
26

如何将代表存储在列表中
How to store delegates in a List(如何将代表存储在列表中)...
2023-11-11 C#/.NET开发问题
6

代表如何工作(在后台)?
How delegates work (in the background)?(代表如何工作(在后台)?)...
2023-11-11 C#/.NET开发问题
5

没有 EndInvoke 的 C# 异步调用?
C# Asynchronous call without EndInvoke?(没有 EndInvoke 的 C# 异步调用?)...
2023-11-11 C#/.NET开发问题
2

Delegate.CreateDelegate() 和泛型:错误绑定到目标方法
Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)...
2023-11-11 C#/.NET开发问题
14