ActivityDesigner.OnMouseDragBegin(Point, MouseEventArgs) 方法
定义
当用户开始在设计器上拖动鼠标时发生。Occurs when the user starts to drag the mouse on the designer.
protected:
virtual void OnMouseDragBegin(System::Drawing::Point initialDragPoint, System::Windows::Forms::MouseEventArgs ^ e);
protected virtual void OnMouseDragBegin (System.Drawing.Point initialDragPoint, System.Windows.Forms.MouseEventArgs e);
abstract member OnMouseDragBegin : System.Drawing.Point * System.Windows.Forms.MouseEventArgs -> unit
override this.OnMouseDragBegin : System.Drawing.Point * System.Windows.Forms.MouseEventArgs -> unit
Protected Overridable Sub OnMouseDragBegin (initialDragPoint As Point, e As MouseEventArgs)
参数
包含事件数据的 MouseEventArgs。A MouseEventArgs that contains the event data.
注解
下面描述与拖放操作相关的事件的引发方式以及引发时间。The following describes how and when events related to drag-and-drop operations are raised.
如果设计器是有效的放置目标,则会引发 OnGiveFeedback 事件并产生指定的拖放效果。If the designer is a valid drop target, the OnGiveFeedback event is raised with the drag-and-drop effect specified. 有关拖放效果的列表,请参见 DragDropEffects 枚举。For a list of drag-and-drop effects, see the DragDropEffects enumeration.
跟踪指针位置、键盘状态和鼠标按钮状态的更改。Changes in the pointer position, keyboard state, and mouse button state are tracked.
如果用户将鼠标移出设计器边界,则会引发 OnDragLeave 事件。If the user moves out of the designer bounds, the OnDragLeave event is raised.
如果鼠标进入另一个设计器,则会引发该设计器的 OnDragEnter。If the mouse enters another designer, the OnDragEnter for that designer is raised.
如果鼠标发生移动但停留在同一设计器中,则会引发 OnDragOver 事件。If the mouse moves but stays within the same designer, the OnDragOver event is raised.
如果键盘或鼠标按钮状态发生了更改,则会引发 OnQueryContinueDrag 事件并根据事件 QueryContinueDragEventArgs 的 Action 属性值确定是继续拖动数据、放置数据还是取消操作。If there is a change in the keyboard or mouse button state, the OnQueryContinueDrag event is raised and determines whether to continue the drag, to drop the data, or to cancel the operation based on the value of the Action property of the event QueryContinueDragEventArgs.
如果该值为 DragAction.Continue,则会引发 OnDragOver 事件以继续操作,并引发 OnGiveFeedback 事件以产生新效果,从而能够设置适当的视觉反馈。If the value is DragAction.Continue, the OnDragOver event is raised to continue the operation and the OnGiveFeedback event is raised with the new effect so appropriate visual feedback can be set. 有关有效放置效果的列表,请参见 DragDropEffects 枚举。For a list of valid drop effects, see the DragDropEffects enumeration.
备注
OnDragOver 和 OnGiveFeedback 事件成对发生,以便当鼠标移到放置目标上时,就能够为用户提供有关鼠标位置的最新反馈。The OnDragOver and OnGiveFeedback events are paired so that as the mouse moves across the drop target, the user is supplied with the most up to date feedback on the mouse position.
如果该值为 DragAction.Drop,则会向源返回放置效果值,以便源应用程序可以对源数据执行适当的操作;例如,如果是移动操作,则会剪切数据。If the value is DragAction.Drop, the drop effect value is returned to the source, so that the source application can perform the appropriate operation on the source data; for example, cut the data if the operation was a move.
如果该值为 DragAction.Cancel,则会引发 OnDragLeave 事件。If the value is DragAction.Cancel, the OnDragLeave event is raised.
有关如何处理事件的详细信息,请参阅 处理和引发事件。For more information about how to handle events, see Handling and Raising Events.