共用方式為


IVsHierarchyDropDataTarget.DragEnter Method

Definition

Called as soon as the mouse drags an item over a new hierarchy or hierarchy window.

public:
 int DragEnter(Microsoft::VisualStudio::OLE::Interop::IDataObject ^ pDataObject, System::UInt32 grfKeyState, System::UInt32 itemid, [Runtime::InteropServices::Out] System::UInt32 % pdwEffect);
int DragEnter(Microsoft::VisualStudio::OLE::Interop::IDataObject const & pDataObject, unsigned int grfKeyState, unsigned int itemid, [Runtime::InteropServices::Out] unsigned int & pdwEffect);
public int DragEnter (Microsoft.VisualStudio.OLE.Interop.IDataObject pDataObject, uint grfKeyState, uint itemid, out uint pdwEffect);
abstract member DragEnter : Microsoft.VisualStudio.OLE.Interop.IDataObject * uint32 * uint32 * uint32 -> int
Public Function DragEnter (pDataObject As IDataObject, grfKeyState As UInteger, itemid As UInteger, ByRef pdwEffect As UInteger) As Integer

Parameters

pDataObject
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
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.[1|1] Hex[1|2] Value[1|3] Description[2|1] 0x0001[2|2] MK_LBUTTON[2|3] Left mouse button is clicked.[3|1] 0x0002[3|2] MK_RBUTTON[3|3] Right mouse button is clicked.[4|1] 0x0004[4|2] MK_SHIFT[4|3] SHIFT key is pressed.[5|1] 0x0008[5|2] MK_CONTROL[5|3] CONTROL key is pressed.[6|1] 0x0010[6|2] MK_MBUTTON[6|3] Middle mouse button is clicked.[7|1] 0x0020[7|2] MK_ALT[7|3] ALT key is pressed.

itemid
UInt32

[in] Item identifier of the item currently being dragged. For a list of itemid values, see VSITEMID.

pdwEffect
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.

Returns

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:

Note

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.

Applies to