C# WPF如何模拟触摸屏Touch事件??急急急 重谢!!在线等!!
把一个触摸屏的输入改成其他的输入方式,但是如果大改的话太麻烦了!想通过代码来模拟触发WPF的触摸屏事件,该怎么写???十分十分感谢!!...
把一个触摸屏的输入改成其他的输入方式,但是如果大改的话太麻烦了!
想通过代码来模拟触发WPF的触摸屏事件,该怎么写???十分十分感谢!! 展开
想通过代码来模拟触发WPF的触摸屏事件,该怎么写???十分十分感谢!! 展开
2016-01-22
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
private void SendToUIThread(UIElement element, string text)
{
element.Dispatcher.BeginInvoke(
new Action(() => { SendKeys.Send(element, text); }),
DispatcherPriority.Input
);
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
ThreadPool.QueueUserWorkItem(_ =>
{
//SendToUIThread(textbox1, "Happy");
//Thread.Sleep(1000);
//SendToUIThread(textbox1, " N");
//Thread.Sleep(1000);
//SendToUIThread(textbox1, "e");
//Thread.Sleep(1000);
//SendToUIThread(textbox1, "w");
//Thread.Sleep(1000);
//SendToUIThread(textbox1, " Year!");
//Thread.Sleep(1000);
//SendToUIThread(Change, "{ENTER}");
SendToUIThread(mainWin, "{ENTER}");
});
}
private void Change_Click(object sender, RoutedEventArgs e)
{
textbox1.Foreground = new SolidColorBrush(Colors.Red);
}
{
element.Dispatcher.BeginInvoke(
new Action(() => { SendKeys.Send(element, text); }),
DispatcherPriority.Input
);
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
ThreadPool.QueueUserWorkItem(_ =>
{
//SendToUIThread(textbox1, "Happy");
//Thread.Sleep(1000);
//SendToUIThread(textbox1, " N");
//Thread.Sleep(1000);
//SendToUIThread(textbox1, "e");
//Thread.Sleep(1000);
//SendToUIThread(textbox1, "w");
//Thread.Sleep(1000);
//SendToUIThread(textbox1, " Year!");
//Thread.Sleep(1000);
//SendToUIThread(Change, "{ENTER}");
SendToUIThread(mainWin, "{ENTER}");
});
}
private void Change_Click(object sender, RoutedEventArgs e)
{
textbox1.Foreground = new SolidColorBrush(Colors.Red);
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询