代码如下:

public class KeyBoardHelper
{
#region 键盘控制
/// <summary>
/// 显示键盘
/// </summary>
public static void ShowInputPanel()
{
string path = @"C:\Program Files\Common Files\microsoft shared\ink\TabTip.exe";
string path32 = @"C:\Program Files (x86)\Common Files\Microsoft Shared\Ink\TabTip32.exe";
if (File.Exists(path))
{
Process.Start(path);
}
else if (File.Exists(path32))
{
Process.Start(path32);
}
} #region import 软键盘
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
private const Int32 WM_SYSCOMMAND = ;
private const UInt32 SC_CLOSE = ;
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool PostMessage(IntPtr hWnd, int Msg, uint wParam, uint lParam);
#endregion
/// <summary>
/// 隐藏屏幕键盘
/// </summary>
public static void HideInputPanel()
{
IntPtr TouchhWnd = new IntPtr();
TouchhWnd = FindWindow("IPTip_Main_Window", null);
if (TouchhWnd == IntPtr.Zero)
return;
PostMessage(TouchhWnd, WM_SYSCOMMAND, SC_CLOSE, );
}
#endregion
}

Win8环境WPF打开和关闭软键盘的更多相关文章

  1. 获取edit焦点,打开和关闭软键盘

    打开: et_search.requestFocus(); et_search.setFocusable(true); et_search.setFocusableInTouchMode(true); ...

  2. Android开发:在EditText中关闭软键盘 转来的

    1.EditText有焦点(focusable为true)阻止输入法弹出 editText=(EditText)findViewById(R.id.txtBody); editText.setOnTo ...

  3. ios键盘弹起 body的高度拉长,页面底部空白问题。ios软键盘将页面抵到上面后,关闭软键盘页面不回弹的问题。

    js 监听ios手机键盘弹起和收起的事件 /* js 监听ios手机键盘弹起和收起的事件 */ document.body.addEventListener('focusin', () => { ...

  4. Android 开启与关闭软键盘

    http://www.cnblogs.com/weixing/p/3300908.html InputMethodManager imm = (InputMethodManager)getSystem ...

  5. 【Swift】- UITextField完成输入后关闭软键盘的几种方法

    总结了以下几种方式,欢迎补充  1,为空白区域绑定Touch Up Inside事件  2,重写touchesEnded方法  3,为TextField绑定Did End On Exit事件 1,点击 ...

  6. android中关闭软键盘

    /**隐藏软键盘**/ View view = getWindow().peekDecorView(); if (view != null) { InputMethodManager inputman ...

  7. android 点击屏幕关闭 软键盘

    //点击屏幕 关闭输入弹出框 @Override public boolean onTouchEvent(MotionEvent event) { InputMethodManager im = (I ...

  8. Android开发,在Fragment中,隐藏或关闭软键盘(虚拟键盘)的方法

    网上可以搜到各种方法,实际测试中,我的开发用机中,仅仅下面这个方法有效,记录一下. //隐藏虚拟键盘      public static void HideKeyboard(View v)      ...

  9. Android 隐藏关闭软键盘

    直接复制代码就可以用 InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVI ...

随机推荐

  1. linux下gimp的使用

    参考资料: http://wenku.baidu.com/view/345c525f804d2b160b4ec070.html 没有视频, 只靠自己摸索使用... 参考文章: http://www.3 ...

  2. Python画图笔记

    matplotlib的官方网址:http://matplotlib.org/ 问题 Python Matplotlib画图,在坐标轴.标题显示这五个字符 ⊥ + - ⊺ ⨁,并且保存后也能显示   h ...

  3. ggplot2 上篇

    title: "ggplot2 上篇" author: "li_volleyball" date: "2016年4月16日" output: ...

  4. nyoj 236拦截导弹 简单动归(java)

    C/C++: #include<stdio.h> int main() { // freopen("250.txt","r",stdin); ],b ...

  5. POJ 2031 Building a Space Station

    3维空间中的最小生成树....好久没碰关于图的东西了.....              Building a Space Station Time Limit: 1000MS   Memory Li ...

  6. 第一节 HTML网页和CSS样式

    1. 第一行 <!DOCTYPE html> 表明网页使用的是HTML5版本 2. 网页的head内容,包含了 title,meta. 3. 网页的标题 title,注意这个显示在浏览器的 ...

  7. 【python网络编程】新浪爬虫:关键词搜索爬取微博数据

    上学期参加了一个大数据比赛,需要抓取大量数据,于是我从新浪微博下手,本来准备使用新浪的API的,无奈新浪并没有开放关键字搜索的API,所以只能用爬虫来获取了.幸运的是,新浪提供了一个高级搜索功能,为我 ...

  8. 第六天 做的app不会改变什么

    app包括资源和功能,做完之后没有改变什么

  9. NoSuchMethodException问题总结

    1.编译异常,这个很容易发现并解决: method真的没有 替换jar包没有clean project. 2.编译正常,运行报错 这是一个遇到之后让人纳闷的异常,脑袋不转弯的时候真的容易被卡住.这时只 ...

  10. Gunicorn 和 Nginx

    Web Application Deployment Using Nginx Nginx is a very high performant web server / (reverse)-proxy. ...