IVsHierarchyDropDataTarget.DragEnter Method
Called as soon as the mouse drags an item over a new hierarchy or hierarchy window.
Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
Syntax
'宣言
Function DragEnter ( _
pDataObject As IDataObject, _
grfKeyState As UInteger, _
itemid As UInteger, _
<OutAttribute> ByRef pdwEffect As UInteger _
) As Integer
'使用
Dim instance As IVsHierarchyDropDataTarget
Dim pDataObject As IDataObject
Dim grfKeyState As UInteger
Dim itemid As UInteger
Dim pdwEffect As UInteger
Dim returnValue As Integer
returnValue = instance.DragEnter(pDataObject, _
grfKeyState, itemid, pdwEffect)
int DragEnter(
IDataObject pDataObject,
uint grfKeyState,
uint itemid,
out uint pdwEffect
)
int DragEnter(
[InAttribute] IDataObject^ pDataObject,
[InAttribute] unsigned int grfKeyState,
[InAttribute] unsigned int itemid,
[InAttribute] [OutAttribute] unsigned int% pdwEffect
)
function DragEnter(
pDataObject : IDataObject,
grfKeyState : uint,
itemid : uint,
pdwEffect : uint
) : int
Parameters
pDataObject
Type: Microsoft.VisualStudio.OLE.Interop.IDataObject[in] Pointer to the IDataObject interface on the item being dragged. This data object contains the data being transferred in the drag-and-drop operation. If the drop occurs, then this data object (item) is incorporated into the hierarchy window.
grfKeyState
Type: System.UInt32[in] Current state of the keyboard and the mouse modifier keys. Valid values are shown in the following table. These values can be combined using a bitwise OR operator.
Hex
Value
Description
0x0001
MK_LBUTTON
Left mouse button is clicked.
0x0002
MK_RBUTTON
Right mouse button is clicked.
0x0004
MK_SHIFT
SHIFT key is pressed.
0x0008
MK_CONTROL
CONTROL key is pressed.
0x0010
MK_MBUTTON
Middle mouse button is clicked.
0x0020
MK_ALT
ALT key is pressed.
itemid
Type: System.UInt32[in] Item identifier of the item currently being dragged. For a list of itemid values, see VSITEMID.
pdwEffect
Type: System.UInt32%[in, out] On entry, pointer to the value of the pdwEffect parameter of the IVsHierarchy object, identifying all effects that the hierarchy supports. On return, must contain one of the effect flags that indicate the result of the drop operation. For more information, see IVsHierarchyDropDataSource2.
Return Value
Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
Remarks
COM Signature
From vsshell.idl:
HRESULT IVsHierarchyDropDataTarget::DragEnter(
[in]IDataObject * pDataObject,
[in]DWORD grfKeyState,
[in]VSITEMID itemid,
[in, out]DWORD * pdwEffect
);
The DragEnter method is called when an item first enters the hierarchy window or when the item is dragged over a new hierarchy. After calling the DragEnter method, the hierarchy calls the DragOver method until the item leaves the new hierarchy or hierarchy window, at which point it calls the DragLeave or Drop method.
The DragEnter method also passes in the state of the keyboard keys and mouse buttons (whether one or more is being pressed).
Drop effects are included in the pdwEffect parameter and describe the action associated with a drop operation. The following table shows possible pdwEffect values and their descriptions:
注意
These effects are exclusive and cannot be combined using the bitwise OR operator.
EFFECT name |
Value 1 |
Description |
---|---|---|
DROPEFFECT_NONE |
0 |
Drop target (hierarchy window) cannot accept the data. No drop would be allowed. |
DROPEFFECT_COPY |
1 |
Dropped item remains in the source and a copy of it is added to the target. |
DROPEFFECT_MOVE |
2 |
Dropped item was added to the target. The item is removed from the source and its storage is deleted. |
DROPEFFECT_LINK |
4 |
A link to the source item is added to the target. The source item should then be removed from the source but the storage should remain so that the link is not broken. A link is a special case of move. |
The values of the pwdEffects parameter are taken from the DragDropEffects enumeration.
Permissions
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
IVsHierarchyDropDataTarget Interface