使用vb.net更改Windows应用程序中窗体上存在的所有控件的语言 [英] Change Language of all the controls present on form in windows application using vb.net

查看:60
本文介绍了使用vb.net更改Windows应用程序中窗体上存在的所有控件的语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求,我必须在动态选择语言时将所有控件的文本属性更改为不同的语言。



提前感谢。

I have a requirement where i have to change all my control's text property to different languages on selection of language dynamically.

Thanks in advance.

推荐答案

我从来没有这样做,但我相信这正是资源文件应该做的事情。基本理论是将所有控制文本转换为字符串资源,为每个控件文本提供唯一标签,并确保代码使用这些标签而不是静态字符串。使用相同的标签创建另一个资源文件,然后您可以互换一个。根据需要制作尽可能多的资源文件。



这项技术称为本地化。它非常简单,但可以有很多移动部件,而不仅仅是作为快速解决方案。搜索.net本地化应该可以为您提供所需的所有信息。通常的做法是将资源文件保存为动态链接库;在应用程序运行时进行热交换可能会非常棘手。
I've never had to do this, but I believe this is exactly what resource files are supposed to do. The basic theory is to turn all of your control text into string resources, give each one a unique label, and make sure your code uses those labels rather than static strings. Create another resource file using the same labels, and then you can swap one for another. Make as many resource files as you need to support.

The technology is called localization. It is pretty straightforward, but there can be a lot of moving parts, more than can be addressed as a quick answer. A search for ".net localization" should give you all the information you need. The usual practice is to save the resource files as dynamic link libraries; hot-swapping those while the application is running is probably going to be very tricky.


这篇关于使用vb.net更改Windows应用程序中窗体上存在的所有控件的语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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