码迷,mamicode.com
首页 > Windows程序 > 详细

WPF-模拟键盘输入

时间:2015-12-28 18:20:20      阅读:237      评论:0      收藏:0      [点我收藏+]

标签:

public static void SendToUIThread(UIElement element, string text)
        {
            element.Dispatcher.BeginInvoke(
                new Action(() => { SendKeys.SendWait(text); }),
                DispatcherPriority.Input
            );
        }
//后台调用
private void Key_Click(object sender, RoutedEventArgs e)
        {
            Button btn = (Button)sender;
            Model.VM_Key.SendToUIThread((UIElement)Keyboard.FocusedElement, btn.Content.ToString());
        }

 

WPF-模拟键盘输入

标签:

原文地址:http://www.cnblogs.com/zhaohaoran/p/5083259.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!