获取当前的键盘语言 [英] Get current keyboard language

查看:131
本文介绍了获取当前的键盘语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我是这个网站的新手.....

可以告诉我如何在VB.net中获取当前的键盘语言,即使我的程序是不活跃????





谢谢....

Hello,
I am new in this website .....
Can one tell me how to get current keyboard language in VB.net even my program is not active????


thank you....

推荐答案

lblLang.Text = InputLanguage.CurrentInputLanguage.LayoutName
lblLang.Text = InputLanguage.CurrentInputLanguage.LayoutName


使用 CultureInfo.KeyboardLayoutId Property [ ^ ]

Use the CultureInfo.KeyboardLayoutId Property[^]
Console.WriteLine(CultureInfo.CurrentCulture.KeyboardLayoutId);
Console.WriteLine(CultureInfo.CurrentCulture.EnglishName);





即使我的程序未激活也意味着什么任何人猜测 - 如果你的程序没有运行,那么就无法做任何事情...







我不是说我的程序没有运行,我的意思是程序的形式。



Soppuse我有一个程序表格表格有一个标签我想要显示当前的计算机语言(存在于任务栏中),即使这个标签形式也没有激活。



现在是想法很清楚????




奇怪的请求,但是......

为你的项目添加一个UserControl 。

为你的用户控件添加一个标签。

将以下代码添加到你的UserControls加载事件:



Quite what "even my program is not active" means is anybodies guess - if your program isn't running, then it can't do anything...



"I don't mean that my program isn't running, I mean the form of program.

Soppuse I have a program form in the form there is a label I want to diplay the current computer lanuage (that exist in the task bar) in this even this label form is not active.

Now is tha idea is clear????"


Strange request, but...
Add a UserControl to your project.
Add a Label to your user control.
Add the following code to your UserControls Load event:

private void MyUserControl_Load(object sender, EventArgs e)
    {
    if (this.DesignMode)
        {
        label1.Text = CultureInfo.CurrentCulture.EnglishName;
        }
    }


这篇关于获取当前的键盘语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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