Table of contents
TOC
折叠目录
展开目录

BeforeDragOver 事件BeforeDragOver Event

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

正在进行拖放操作时发生。语法对于框架专用子对象_BeforeDragOver (ByVal取消为 MSForms.ReturnBooleanctrl为控制ByVal数据为数据对象ByValX作为单个ByValY作为单个ByValDragState与 fmDragStateByVal效果为 MSForms.ReturnEffectByVal移动与 fmShiftState)为多页专用子对象_BeforeDragOver (索引作为长ByVal取消为 MSForms.ReturnBooleanctrl为控制ByVal数据为数据对象ByValX作为单一ByValY作为单一ByValDragState作为fmDragStateByVal效果为 MSForms.ReturnEffectByValShift与 fmShiftState) TabStrip 的私有子对象_BeforeDragOver (索引作为长ByVal取消为 MSForms.ReturnBooleanByVal数据为数据对象ByValX作为单一ByValY作为单个ByValDragState与 fmDragStateByVal效果为 MSForms.ReturnEffectByValShift与 fmShiftState)对于其他控制专用子对象_BeforeDragOver (ByVal取消为 MSForms.ReturnBooleanByVal数据为数据对象ByValX作为一个ByValY作为单个ByValDragState与 fmDragStateByVal效果为 MSForms.ReturnEffectByVal移位与 fmShiftState)BeforeDragOver事件语法具有下列组成部分:Occurs when a drag-and-drop operation is in progress. Syntax For Frame Private SubobjectBeforeDragOver( ByVal_CancelAs MSForms.ReturnBoolean, ctrlAs Control, ByValDataAs DataObject, ByValXAs Single, ByValYAs Single, ByValDragStateAs fmDragState, ByValEffectAs MSForms.ReturnEffect, ByValShiftAs fmShiftState) For MultiPage Private SubobjectBeforeDragOver(_indexAs Long, ByValCancelAs MSForms.ReturnBoolean, ctrlAs Control, ByValDataAs DataObject, ByValXAs Single, ByValYAs Single, ByValDragStateAs fmDragState, ByValEffectAs MSForms.ReturnEffect, ByValShiftAs fmShiftState) For TabStrip Private SubobjectBeforeDragOver(_indexAs Long, ByValCancelAs MSForms.ReturnBoolean, ByValDataAs DataObject, ByValXAs Single, ByValYAs Single, ByValDragStateAs fmDragState, ByValEffectAs MSForms.ReturnEffect, ByValShiftAs fmShiftState) For other controls Private SubobjectBeforeDragOver( ByVal_CancelAs MSForms.ReturnBoolean, ByValDataAs DataObject, ByValXAs Single, ByValYAs Single, ByValDragStateAs fmDragState, ByValEffectAs MSForms.ReturnEffect, ByValShiftAs fmShiftState) The BeforeDragOver event syntax has these parts:

部件Part说明Description
objectobject必需。一个有效对象名称。Required. A valid object name.
索引index必填。在拖放操作将影响多页的索引。Required. The index of the Page in a MultiPage that the drag-and-drop operation will affect.
CancelCancel必填。事件状态。 False ,指示该控件处理的事件 (默认值)。为 true ,则表示该应用程序处理的事件。Required. Event status. False indicates that the control should handle the event (default). True indicates the application handles the event.
ctrl 键ctrl必需。被拖过的控件。Required. The control being dragged over.
DataData必填。在拖放操作中拖动的数据。数据封装在数据对象中。Required. Data that is dragged in a drag-and-drop operation. The data is packaged in a DataObject.
X、 YX, Y必填。该控件的位置的水平和垂直坐标。这两个坐标都以磅为单位。 X_被指从控件的左边缘_Y_被指从控件的顶部.Required. The horizontal and vertical coordinates of the control's position. Both coordinates are measured in points. _X is measured from the left edge of the control; Y is measured from the top of the control..
DragStateDragState必需。被拖动数据的切换状态。Required. Transition state of the data being dragged.
EffectEffect必填。放置源所支持的操作。Required. Operations supported by the drop source.
ShiftShift必需项。指定 SHIFT、CTRL 和 ALT 的状态。Required. Specifies the state of SHIFT, CTRL, and ALT.

设置DragState_的设置如下:Settings The settings for _DragState are:

常量ConstantValue说明Description
fmDragStateEnterfmDragStateEnter00鼠标指针在目标的范围内。Mouse pointer is within range of a target.
fmDragStateLeavefmDragStateLeave11鼠标指针在目标的范围外。Mouse pointer is outside the range of a target.
fmDragStateOverfmDragStateOver22鼠标指针在新位置,但仍保留在同一目标的范围内。Mouse pointer is at a new position, but remains within range of the same target.

效果_设置包括:The settings for _Effect are:

常量ConstantValue说明Description
fmDropEffectNonefmDropEffectNone00不将拖放源复制或移动到拖放目标。Does not copy or move the drop source to the drop target.
fmDropEffectCopyfmDropEffectCopy11将拖放源复制到拖放目标。Copies the drop source to the drop target.
fmDropEffectMovefmDropEffectMove22将拖放源移动到拖放目标。Moves the drop source to the drop target.
fmDropEffectCopyOrMovefmDropEffectCopyOrMove33将拖放源复制或移动到拖放目标。Copies or moves the drop source to the drop target.

进行_移位时,设置如下:The settings for _Shift are:

常量ConstantValue说明Description
fmShiftMaskfmShiftMask11已按下 Shift 键。SHIFT was pressed.
fmCtrlMaskfmCtrlMask22已按下 Ctrl 键。CTRL was pressed.
fmAltMaskfmAltMask44已按下 Alt 键。ALT was pressed.

备注使用此事件来监视鼠标指针,因为它进入、 离开或将直接在一个有效的目标上。拖放操作时,系统初始化此事件,当用户移动鼠标或按下或释放鼠标按钮。鼠标指针的位置决定接收此事件的目标对象。您可以通过检查_DragState_参数来确定鼠标指针的状态。当控件处理该事件时,可以使用_效果_参数来标识要执行的拖放操作。当_效果_设置为fmDropEffectCopyOrMove时,拖放源支持的副本 ( fmDropEffectCopy )、 移动 ( fmDropEffectMove ) 或取消 ( fmDropEffectNone ) 操作。当_效果_设置为fmDropEffectCopy时,拖放源支持的副本或取消 ( fmDropEffectNone ) 操作。当_效果_设置为fmDropEffectMove时,拖放源支持移动或取消 ( fmDropEffectNone ) 操作。当_效果_设置为fmDropEffectNone。拖放源支持取消操作。大多数控件不支持拖放时_取消_为False,这是默认设置。这意味着控件拒绝尝试拖动或放任何东西在控件中,并且该控件不会触发 BeforeDropOrPaste 事件。文本框组合框控件是例外。即使_取消_为False,这些控件支持拖放操作。Remarks Use this event to monitor the mouse pointer as it enters, leaves, or rests directly over a valid target. When a drag-and-drop operation is in progress, the system initiates this event when the user moves the mouse, or presses or releases the mouse button or buttons. The mouse pointer position determines the target object that receives this event. You can determine the state of the mouse pointer by examining the DragState argument. When a control handles this event, you can use the Effect argument to identify the drag-and-drop action to perform. When Effect is set to fmDropEffectCopyOrMove, the drop source supports a copy ( fmDropEffectCopy ), move ( fmDropEffectMove ), or a cancel ( fmDropEffectNone ) operation. When Effect is set to fmDropEffectCopy, the drop source supports a copy or a cancel ( fmDropEffectNone ) operation. When Effect is set to fmDropEffectMove, the drop source supports a move or a cancel ( fmDropEffectNone ) operation. When Effect is set to fmDropEffectNone. the drop source supports a cancel operation. Most controls do not support drag-and-drop while Cancel is False, which is the default setting. This means the control rejects attempts to drag or drop anything on the control, and the control does not initiate the BeforeDropOrPaste event. The TextBox and ComboBox controls are exceptions to this; these controls support drag-and-drop operations even when Cancel is False.

© 2018 Microsoft