How to get Touchscreen to use Mouse Events instead of Touch Events in C# app

时光毁灭记忆、已成空白 提交于 2019-11-28 14:12:24

What you can do is to use the same method for both, something like this:

protected override void OnPreviewMouseUp(MouseButtonEventArgs e)
{
    OnPreviewTouchMouseUp(e);
}

protected override void OnPreviewTouchUp(TouchEventArgs e)
{
    OnPreviewTouchMouseUp(e);
}

private void OnPreviewTouchMouseUp(EventArgs e)
{

}

The only difference will be the way you get the coordinates of the mouse/touch:

For touch:

e.GetTouchPoint(this).Position;

For mouse:

e.GetPosition(this);
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!