c# - DragEnter 和 GiveFeedback 之间的区别

标签 c#

我正在尝试一些拖放功能,但无法辨别Give FeedbackDrag Enter 事件之间的区别。

Drag Enter上,我们检查它所进入的元素是否可以接受将要放置的对象并向用户显示某种预览。

类似地,如果拖动的元素将被删除,提供反馈也会向用户显示放置目标的预览。

这两者有什么区别?

类似Drag OverDrag 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 仅针对有效的放置目标引发。

DragEnterDragOver 的区别在于,前者仅在鼠标进入控制状态时才会抬起,而后者可以在鼠标移到控件上时多次抬起。相同的控制。

Control.DragEnter Event

关于c# - DragEnter 和 GiveFeedback 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11257178/

相关文章:

c# - 方法内联如何用于 C# 中的自动属性?

c# - 一个 Button 会自动添加一个带有名称的新 Button

c# - 将 .net 图形转换为 java

C# 类型 _ 没有定义构造函数

c# - NullReferenceException 在 ASP.NET MVC 5 中使用 DropDownListFor

c# - 使用反射来识别具有给定装饰器的属性

c# - 将本地时间转换为 UTC

c# - 在另一个窗口中居中 C# Windows 窗体

c# - FileStream.Position 返回负值

c# - 当数据库中的数据发生更改时,LINQ to SQL 不会更新