【发布时间】:2011-11-15 05:26:38
【问题描述】:
由于我有内置键盘,所以我的 WPF 应用程序中不需要系统范围的虚拟键盘。我为文本框设置了IsHitTestVisible="False",但虚拟键盘缩略图仍然可见。
【问题讨论】:
由于我有内置键盘,所以我的 WPF 应用程序中不需要系统范围的虚拟键盘。我为文本框设置了IsHitTestVisible="False",但虚拟键盘缩略图仍然可见。
【问题讨论】:
我回答了类似的问题here,但它是针对windows mobile 6.5;但我想它也可以在 win 7 上运行。下面是隐藏键盘图标的代码:
//Declare Win API method
[DllImport("coredll.dll", EntryPoint="FindWindowW", SetLastError=true)]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName)
[DllImport("coredll.dll", SetLastError=true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, uint uFlags);
[DllImport("coredll.dll", SetLastError = true)]
internal static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
//Call FindWindow and SetWindowPos to hide keyboard icon
IntPtr hWnd = FindWindow(Nothing, "MS_SIPBUTTON");
SetWindowPos(hWnd, 1, 0, 0, 0, 0, &H80);
【讨论】:
查看我的回答here。通过设置注册表值,您可以禁用某个应用程序的屏幕键盘缩略图
【讨论】:
如果你想在特定方法后隐藏虚拟键盘,只需写 this.Focus();
【讨论】: