2

I only noticed this because I mistakenly tried to attach a DragEventHandler to a DragLeave event. I was surprised to see that the DragLeave Event was just as a general EventHandler. This is odd to me because both the DragDrop Event and the DragEnter Event use DragEventHandlers. Is there a reason or explanation for this?

Resources:

http://msdn.microsoft.com/en-us/library/system.windows.forms.control.dragleave http://msdn.microsoft.com/en-us/library/system.windows.forms.control.dragenter http://msdn.microsoft.com/en-us/library/system.windows.forms.control.dragdrop

4

1 回答 1

3

是的。在处理DragEnteror时DragDrop,我们通常需要或更新附加信息(例如当前拖动效果、活动修饰键或实际涉及的数据)。因此,传递给处理程序的事件参数必须提供对该信息的访问。

另一方面,我们可以(或应该)做的事情不多DragLeave。我们不能取消休假。我们无法更改拖动引擎的行为或鼠标指针的形状,因为它是,嗯,系统告诉我们的方式thank you for your cooperation, we're done now, maybe we'll get in touch with you again in the future

于 2012-06-08T19:16:43.457 回答