WPF 4拖放与视觉元素作为光标 [英] WPF 4 Drag and Drop with visual element as cursor

查看:10
本文介绍了WPF 4拖放与视觉元素作为光标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 WPF 4 应用程序,我想启用拖放功能,目前我有一个基本的拖放实现,但我发现如果不是改变鼠标光标,它会好得多over 来表示移动操作,我可以在我的手指下使用一个图像.

I have a WPF 4 app which I want to enable drag and drop with, currently I have it working with a basic drag and drop implementation, but I have found that it would be much better if, instead of the mouse cursor changing over to represent the move operation, I could use an image underneath my finger.

我的拖放操作是在自定义用户控件中启动的,因此我需要将可视元素插入可视树并让它跟随我的手指,也许我应该启用 ManipulationDelta我的主窗口上的事件,检查布尔值然后移动项目?

My drag and drop operation is initiated inside a custom user control, so I will need to insert a visual element into the visual tree and have it follow my finger around, perhaps I should enable the ManipulationDelta event on my main window, check for a boolean then move the item around?

推荐答案

有一个使用自定义拖动光标的例子 在 Jaime Rodriguez msdn 博客.您可以处理 GiveFeedback 事件并更改鼠标光标,但要使用自定义 Visual,作者创建一个新窗口并更新 QueryContinueDrag.

There is an example of using a custom drag cursor at Jaime Rodriguez msdn blog. You can handle the GiveFeedback event and change the mouse cursor, but to use a custom Visual the author creates a new Window and updates the position on QueryContinueDrag.

这篇关于WPF 4拖放与视觉元素作为光标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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