问题描述
我有一个需要虚拟键盘的应用.但是,当我单击某些 TextBox
时,它们不会显示虚拟键盘.我试过用这个:
System.Diagnostics.Process.Start("osk.exe");
但这会打开另一个键盘,该键盘在 TextBox
没有焦点后不会关闭.如何强制win10打开虚拟平板键盘?
为了让自己清楚:
这是在 win10 触摸屏 PC 上运行的.当我启用平板电脑模式时,虚拟键盘会出现在某些 TextBox
上,而在其他人上没有.这就是为什么我要强制键盘显示.
从那以后,我找到了一种显示虚拟平板电脑键盘"的方法,但是我想使用
您可以以编程方式添加密钥,我认为您需要管理员权限.我尝试以编程方式添加密钥但不起作用,它使条目加倍而没有任何影响(小心);
建议:
考虑,为您创建的每个进程做一个进程停止器.我假设您将在文本框(任何输入法)请求焦点时使用它.当组件失去焦点时,请务必停止该过程.
希望对您有所帮助.
I have an app that needs a virtual keyboard. But, when I click some of my TextBox
es, they don't make the virtual keyboard appear. I have tried using this:
System.Diagnostics.Process.Start("osk.exe");
But this opens another keyboard, one that does not close after the TextBox
has no focus. How to force win10 to open the virtual tablet keyboard?
To make myself clear:
This is running on a win10 touch screen PC. When I have the tablet mode enabled the virtual keyboard shows up on some TextBox
es and does not on others. Hence why I want to force the keyboard to show.
EDIT:I have since found a way to show the "virtual tablet keyboard", however I would like to do it using the InputPane class. Can someone provide me with a example code just to get me started?
Code to open it without using the InputPane class:
System.Diagnostics.Process.Start("TabTip.exe");
One thing. InputPane, you cannot use in WinForms, InputPane is a element of UWP.
I ran this code... And Works!
string progFiles = @"C:\Program Files\Common Files\Microsoft Shared\ink";
string keyboardPath = Path.Combine(progFiles, "TabTip.exe");
Process.Start(keyboardPath);
But I had to add a key (MANUALLY) value on my regedit on HKEY_CURRENT_USER\SOFTWARE\Microsoft\TabletTip
inside the key is a folder named 1.7 (this would change in the future by Microsoft) and add a 32 bit DWORD value named EnableDesktopModeAutoInvoke
with value 1
. This means TRUE. It should look like this:
You can add the key programatically I think you need Admin privilegies. I tried add the key programatically but does not work, It double the entry without any effect (BE CAREFUL);
ADVICES:
Consider, do a process stopper for each process you create. I suposse that you will use this when textbox (ar any input method) request focus. be sure stop the process when component loses his focus.
hope this help.
这篇关于如何强制win10打开虚拟平板键盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!