伪造WPF操作事件 [英] Faking WPF Manipulation Events

查看:82
本文介绍了伪造WPF操作事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用鼠标/键盘来伪造操纵(或触摸)事件.当我尝试使用以下方法引发事件时:

I want to fake manipulation (or touch) events using a mouse / keyboard. When I try to raise the events using:

RoutedEventArgs e = new RoutedEventArgs(ManipulationStartedEvent,this);
RaiseEvent(e);

给我错误无法将RoutedEventArgs转换为ManipulationStartedEventArgs,并且尝试创建新的ManipulationStartedEventArgs会导致错误,因为没有ManipulationStartedEventArgs的构造函数.

Gives me the error "Cannot convert RoutedEventArgs to ManipulationStartedEventArgs, and attempting to create a new ManipulationStartedEventArgs results in an error as there are no constructors for ManipulationStartedEventArgs.

有可能这样做吗?

推荐答案

因此,答案是通过使用适当的鼠标输入扩展触摸设备"类来创建自定义触摸设备.

So the answer is to create a Custom Touch Device by extending the Touch Device class with appropriate mouse inputs.

使用Microsoft Multipoint SDK的示例(多鼠标).

这篇关于伪造WPF操作事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆