问题描述
我想使用鼠标/键盘来伪造操纵(或触摸)事件.当我尝试使用以下方法引发事件时:
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操作事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!