保卫萝卜挑战28,洪荒之孔宣明道,吴阿敏42式太极拳
如下截图,textbox,在触摸点击后,会自动弹出windows的虚拟键盘。
如何,禁用键盘的自动弹出?
通过调用taptip.exe或者osk.exe,主动弹出虚拟键盘
详细调用可参考:
textbox在触摸点击后,会自动弹出虚拟键盘,是因为在控件中作了封装。
--textbox中详细tabtip.exe封装看了会,没找到
处理方案:重写textbox的方法oncreateautomationpeer,返回一个uielementautomationpeer而不是automationpeer。
可能原因:textbox自定义实现中返回的是automationpeer,而uielementautomationpeer继承automationpeer,重写了相关键盘属性。
猜测与haskeyboardfocuscore属性有关。
直接复制如下代码:
1 /// <summary> 2 /// 禁用自动弹出虚拟键盘的textbox控件 3 /// </summary> 4 public class textboxnoautokeyboard : textbox 5 { 6 protected override automationpeer oncreateautomationpeer() 7 { 8 return new frameworkelementautomationpeer(this); 9 } 10 }
以上参考自:【stackoverflow】“hide” text box from automatic win10 keyboard showing
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
asp.net搭建博客,使用BlogEngine.NET+MySql搭建博客
网友评论