我正在尝试一些拖放功能,但无法辨别Give Feedback
和Drag Enter
事件之间的区别。
在Drag Enter
上,我们检查它所进入的元素是否可以接受将要放置的对象并向用户显示某种预览。
类似地,如果拖动的元素将被删除,提供反馈
也会向用户显示放置目标的预览。
这两者有什么区别?
类似Drag Over
和Drag Enter
有什么区别?
最佳答案
正如 DragEnter
的文档所述,
The
DragEnter
event is raised when the user first drags the mouse cursor over the control during a drag-and-drop operation.The DoDragDrop method determines the control under the current cursor location. It then checks to see if the control is a valid drop target.
If the control is a valid drop target, the
GiveFeedback
event is raised with the drag-and-drop effect specified.
因此,区别在于 DragEnter
会针对每个控件引发,而 GiveFeedback
仅针对有效的放置目标引发。
DragEnter
和 DragOver
的区别在于,前者仅在鼠标进入控制状态时才会抬起,而后者可以在鼠标移到控件上时多次抬起。相同的控制。
关于c# - DragEnter 和 GiveFeedback 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11257178/