键盘的WinForms屏幕上 [英] Keyboard on the screen in WinForms

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

问题描述

我公司开发的Windows窗体应用程序,它是触摸屏电脑上使用。是否有可能当用户点击输入框(文本框),显示一个键盘?我怎么能做到这一点?

I have developed a Windows Forms application which is used on a touchscreen computer. Is it possible to display a keyboard when the user clicks on an input box (textbox)? And how can i do that ?

推荐答案

您知道Windows有一个屏幕键盘上?

Are you aware Windows has an on screen keyboard?

在Windows 7中是所有程序>周边设备>易于访问>屏幕键盘。

In Windows 7 it is All Programs > Accesseries > Ease Of Access > On Screen Keyboard.

您可以写你自己,如果你想要的,但我使用Windows个都在。一次,当我不喜欢拿起键盘

You can write you own if you want, but I use the Windows one all the time when I do not feel like picking up the keyboard.

您可以创建一个快捷方式:

You can create a shortcut to it:

该位置是%windir%\system32\osk.exe

The location is %windir%\system32\osk.exe

因此,要启动它,在TextBox_Click事件(或者你想火任何事件)

So to launch it, in the TextBox_Click event (or whatever event you want to fire)

//应该工作,我没有测试它。
System.Diagnostics.Process.Start(C:\Windows\System32\osk.exe);

// Should work, I have not tested it. System.Diagnostics.Process.Start("c:\Windows\System32\osk.exe");

只是一个更新:在我机在工作我试图运行该代码(我建立了它作为测试)的错误,我不得不把osk.exe复制到另一个目录,然后运行它和它的工作。

Just an update: On my machine at work I got an error trying to run that code (I built it as a test) and I had to copy the osk.exe to another directory and then launch it and it worked.

    /// <summary>
    /// Test to show launching on screen board (osk.exe).
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void textBox1_Click(object sender, EventArgs e)
    {
        try
        {
            Process.Start(@"c:\Temp\OSK.exe");
        }
        catch (Exception error)
        {
            string err = error.ToString();
        }
    }

和这个代码工作。

这篇关于键盘的WinForms屏幕上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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