【问题标题】:How to disable virtual keyboard support for my app?如何禁用我的应用程序的虚拟键盘支持?
【发布时间】:2011-11-15 05:26:38
【问题描述】:

由于我有内置键盘,所以我的 WPF 应用程序中不需要系统范围的虚拟键盘。我为文本框设置了IsHitTestVisible="False",但虚拟键盘缩略图仍然可见。

【问题讨论】:

    标签: c# wpf windows-7


    【解决方案1】:

    我回答了类似的问题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);
    

    【讨论】:

      【解决方案2】:

      查看我的回答here。通过设置注册表值,您可以禁用某个应用程序的屏幕键盘缩略图

      【讨论】:

        【解决方案3】:

        如果你想在特定方法后隐藏虚拟键盘,只需写 this.Focus();

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2023-03-13
          • 2019-12-01
          • 2013-06-07
          • 2011-10-17
          • 2012-07-09
          • 1970-01-01
          • 2021-04-20
          • 2017-05-09
          相关资源
          最近更新 更多