代码如下:

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. 如何修改mysql默认的数据库密码

    1,首先链接到数据库 mysql -h 127.0.0.1 -uroot -p 2,选择数据库 use mysql; 3,修改user表的密码 UPDATE user SET Password=PAS ...

  2. Memcached存储命令 - set

    Memcached set 命令用于将 value(数据值) 存储在指定的 key(键) 中. 如果set的key已经存在,该命令可以更新该key所对应的原来的数据,也就是实现更新的作用. set 命 ...

  3. webapp中fixed问题解决方案

    主要问题: 1,头部输入框固定后,只要再滑动内容的话,输入框会随着滑动内容而滑动. 2,在低端机:2.3以下的安卓机,你会发现怎么解决都不行的,系统浏览器是不会支持的,头部底部固定的话会滑动内容而滑动 ...

  4. [转]Android性能优化典范

    2015年伊始,Google发布了关于Android性能优化典范的专题,一共16个短视频,每个3-5分钟,帮助开发者创建更快更优秀的Android App.课程专题不仅仅介绍了Android系统中有关 ...

  5. 去除tabbar的灰线

    去掉导航栏的边界灰线 [self.navigationController.navigationBar setBackgroundImage:[[UIImage alloc] init] forBar ...

  6. etcd

    https://github.com/silenceper/dcmp http://studygolang.com/topics/1866

  7. POJ 2151 Check the difficulty of problems

    以前做过的题目了....补集+DP        Check the difficulty of problems Time Limit: 2000MS   Memory Limit: 65536K ...

  8. Shanghai Regional Online Contest 1004

    Shanghai Regional Online Contest 1004 In the ACM International Collegiate Programming Contest, each ...

  9. 使一个div始终显示在页面中间

    使一个div始终显示在页面中间 假设我们有一个div层:<div id=”myDiv”></div> 首先,我们用css来控制它在水平上始终居中,那么我们的css代码应该是这样 ...

  10. 雪峰配置的nginx