我正在为
Windows 8平板电脑编写一个WPF应用程序.它是完整的Windows 8,而不是ARM / RT.
System.Diagnostics.Process.Start(@"C:\Program Files\Common Files\Microsoft Shared\ink\TabTip.exe");
这工作正常,但是我不知道如何再次隐藏键盘?
有谁知道该怎么做?
另外,是否有任何方式可以调整我的应用程序的大小,以便在键盘出现时将对焦控件移开?有点像Windows RT应用程序.
非常感谢
我可以使用以下C#代码成功关闭屏幕键盘.
[DllImport("user32.dll")] public static extern int FindWindow(string lpClassName,string lpWindowName); [DllImport("user32.dll")] public static extern int SendMessage(int hWnd,uint Msg,int wParam,int lParam); public const int WM_SYSCOMMAND = 0x0112; public const int SC_CLOSE = 0xF060; private void cloSEOnscreenKeyboard() { // retrieve the handler of the window int iHandle = FindWindow("IPTIP_Main_Window",""); if (iHandle > 0) { // close the window using API SendMessage(iHandle,WM_SYSCOMMAND,SC_CLOSE,0); } } private void Some_Event_Happened(object sender,EventArgs e) { // It's time to close the onscreen keyboard. cloSEOnscreenKeyboard(); }
我希望这将有助于你.