WPF模拟键盘输入相关问题
来源:互联网 发布:软件项目估计方法 编辑:程序博客网 时间:2024/06/03 20:06
Title: WPF模拟键盘输入相关问题
Author: Kagula
Date: 2015-11-02
允许TextBox输入中文(IME On,默认状态)
<TextBox Width="200" InputMethod.PreferredImeState="On"
InputMethod.IsInputMethodEnabled="True"
InputMethod.PreferredImeConversionMode="FullShape,Native"></TextBox>
禁止TextBox输入中文(IME Off)
<TextBox Width="200" InputMethod.PreferredImeState="Off"
InputMethod.IsInputMethodEnabled="False"></TextBox>
指定默认输入法为中文(IME On)
<TextBox Width="200" InputLanguageManager.InputLanguage="zh-CN"></TextBox>
枚举输入法
foreach (System.Windows.Forms.InputLanguage lang in System.Windows.Forms.InputLanguage.InstalledInputLanguages)
if (lang.LayoutName == "Japanese")
{
System.Windows.Forms.InputLanguage.CurrentInputLanguage = lang;
InputMethod.Current.ImeState = InputMethodState.On;
}
检查物理键盘是否存在
KeyboardCapabilities keyboardCapabilities = new Windows.Devices.Input.KeyboardCapabilities();
return keyboardCapabilities.KeyboardPresent != 0 ? true : false;
windows自带的虚拟键盘
Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.System) + Path.DirectorySeparatorChar + "osk.exe");
WPF TextBox PreviewTextInput handle IME (chinese)
http://blog.csdn.net/muzizongheng/article/details/9291637
TextBox控件,模拟键盘输入(经过IME,所以目标能通过发送英文字符收到中文字符)
_uie.Focus(); _uie of TextBoxSystem.Windows.Forms.SendKeys.SendWait("kwwl");//https://msdn.microsoft.com/zh-cn/library/system.windows.forms.sendkeys.send.aspx//从当前窗口切出后,原窗口ime状态会不见,所以在切换前还要保持原来的ime状态。
TextBox控件,模拟键盘输入(不经过IME,所以目标不能通过发送英文字符收到中文字符)
public static void SendInput(UIElement element, string text){ InputManager inputManager = InputManager.Current; InputDevice inputDevice = inputManager.PrimaryKeyboardDevice; TextComposition composition = new TextComposition(inputManager, element, text); TextCompositionEventArgs args = new TextCompositionEventArgs(inputDevice, composition); args.RoutedEvent = UIElement.PreviewTextInputEvent; element.RaiseEvent(args); args.RoutedEvent = UIElement.TextInputEvent; element.RaiseEvent(args);}
打开IME的一种方式
Window mainWindow = Application.Current.MainWindow;
WindowInteropHelper helper = new WindowInteropHelper(mainWindow);
IntPtr hImc = ImmGetContext(helper.Handle);
bool imeOpen = ImmGetOpenStatus(hImc);
如何控制IME的composition window位置
http://bbs.csdn.net/topics/340034551
- WPF模拟键盘输入相关问题
- 文本框模拟键盘输入 WPF
- SendInput模拟键盘输入的问题
- C# WPF 模拟键盘输入与UI控件进行交互
- keybd_event函数模拟键盘输入的问题
- 模拟键盘输入
- 模拟键盘输入
- 模拟键盘输入
- WPF 捕获键盘输入
- C++学习笔记之SendInput()模拟键盘输入的问题
- 模拟键盘输入器
- C++模拟键盘输入
- C#模拟键盘输入
- 用Delphi模拟键盘输入
- <c#>模拟键盘输入
- Linux 下模拟键盘输入
- 使用Javascript 模拟键盘输入
- Linux 下模拟键盘输入
- Python--函数return后面的语句不执行
- PHP 常用设计模式 总结
- 项目汇报XMind 6来帮您
- 由TNS: 无法解析指定的连接标识符引发的追溯
- 英文论文中常见拉丁语/英语缩写整理
- WPF模拟键盘输入相关问题
- Android之路-启程2:Android开发环境简介以及编写第一个应用程序“HelloWorld”
- VS2013运行时提醒签名错误
- WebSocket 注解 (一)
- 跟我一起学MFC–【目录】
- pdf转换成html格式怎么转的
- window.prompt的确定和取消
- 解决使用Viewpager+fragment时Viewpager与其他View的冲突
- HTML5网页录音和压缩