Windows 10(表面)上的键盘 Winforms [英] Keyboard Winforms on Windows 10 (surface)
问题描述
我的 WinForms 应用程序在带有 Windows 10 平板电脑模式的 Surface Pro 上运行.未连接物理键盘.
i have my WinForms Application running on a Surface Pro with Windows 10 in Tablet Mode. No Physical Keyboard attached.
我启动了我的应用程序,当我点击 TextBox 时,触摸键盘没有出现.(它是一个简单的 Windows.Forms.TextBox 控件)对于我从 TextBox 继承的自定义控件,它不能正常工作.
I launch my Application and when I hit a TextBox the touch keyboard does not appear. (Its a simple Windows.Forms.TextBox Control) With my custom Control that inherits from the TextBox it does not work as well.
当我在 ComboBox 中单击"时,触摸键盘出现在前面.当我单击从 Windows.Forms.ComboBox 继承的自定义 ComboBox 时,它也会出现.
When I "click" in a ComboBox the touch keyboard comes to the front. It also appears when I click in my custom ComboBox that inherits from Windows.Forms.ComboBox.
当我在单击组合框后单击文本框时,打开的触摸键盘会关闭.
When I click to a TextBox after I clicked a ComboBox the opened touch keyboard closes.
我该如何解决我的问题?有没有我可以添加到控件中的 c# 命令以强制触摸键盘的出现?
How can I solve my problem? is there a c# command I can add to the control in order to force the apparition of the touch keyboard?
我已经将设置未处于平板电脑模式且没有连接键盘时显示触摸键盘或手写面板"更改为打开",因为我在另一个线程中阅读了该设置,但没有任何更改.
I already changed the setting "Show the touch keyboard or handwriting panel when not in tablet mode and there's no keyboard attached" to "On", because I read that in another thread, but nothing changed.
感谢您的帮助.
推荐答案
我建议在事件处理程序中使用以下代码:
I would suggest the following code in the event handler:
var progFiles = @"C:\Program Files\Common Files\Microsoft Shared\ink";
var keyboardPath = Path.Combine(progFiles, "TabTip.exe");
this.keyboardProc = Process.Start(keyboardPath);
我们在那里做的是手动启动触摸键盘.
What we are doing there, is manually launching the Touch Keyboard.
这应该可行,但是在文本框失去焦点后自动关闭键盘可能会出现问题.
This should work, however you may have a problem dismissing the keyboard automatically after the textbox lost its focus.
顺便问一下,您是否检查了以下选项是否已启用?
By the way, did you check the following option is enabled?
这篇关于Windows 10(表面)上的键盘 Winforms的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!