共用方式為


IVsObjectList.DoDragDrop(UInt32, IDataObject, UInt32, UInt32) Method

Definition

Asks the given list item to handle a drag-and-drop operation.

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

Parameters

index
UInt32

[in] Specifies the index of the list item of interest.

pDataObject
IDataObject

[in] Pointer to an IDataObject being dropped.

grfKeyState
UInt32

[in] Current state of the keyboard and the mouse modifier keys.

pdwEffect
UInt32

[in, out] On input, the effect being requested. On output, the effect that your object list allows.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsObjectList::DoDragDrop(  
   [in] ULONG Index,  
   [in] IDataObject * pDataObject,  
   [in] DWORD grfKeyState,  
   [in, out]DWORD * pdwEffect  
);  

The environment will call QueryDragDrop to see if your object list supports a drag-drop operation. If you return the call indicating that you do support the requested operation, and the user drops pDataObject by releasing the mouse button, the environment calls DoDragDrop. You must then handle the requested action and return the effect in pdwEffect.

This method is very similar to the standard COM Drop method. Values for grfKeyState can be a bitwise "or" combination of any number of the following: MK_CONTROL, MK_SHIFT, MK_ALT, MK_LBUTTON, MK_MBUTTON, and MK_RBUTTON. Values for the pdwEffect are taken from the DROPEFFECT enumeration.

Applies to