共用方式為


IVsSimpleObjectList2.DoDragDrop Method

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

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop.8.0 (in Microsoft.VisualStudio.Shell.Interop.8.0.dll)

Syntax

'宣告
Function DoDragDrop ( _
    index As UInteger, _
    pDataObject As IDataObject, _
    grfKeyState As UInteger, _
    <OutAttribute> ByRef pdwEffect As UInteger _
) As Integer
'用途
Dim instance As IVsSimpleObjectList2
Dim index As UInteger
Dim pDataObject As IDataObject
Dim grfKeyState As UInteger
Dim pdwEffect As UInteger
Dim returnValue As Integer

returnValue = instance.DoDragDrop(index, _
    pDataObject, grfKeyState, pdwEffect)
int DoDragDrop(
    uint index,
    IDataObject pDataObject,
    uint grfKeyState,
    out uint pdwEffect
)
int DoDragDrop(
    [InAttribute] unsigned int index, 
    [InAttribute] IDataObject^ pDataObject, 
    [InAttribute] unsigned int grfKeyState, 
    [InAttribute] [OutAttribute] unsigned int% pdwEffect
)
abstract DoDragDrop : 
        index:uint32 * 
        pDataObject:IDataObject * 
        grfKeyState:uint32 * 
        pdwEffect:uint32 byref -> int 
function DoDragDrop(
    index : uint, 
    pDataObject : IDataObject, 
    grfKeyState : uint, 
    pdwEffect : uint
) : int

Parameters

  • index
    Type: System.UInt32
    [in] Specifies the index of the list item of interest.
  • grfKeyState
    Type: System.UInt32
    [in] Current state of the keyboard and the mouse modifier keys.
  • pdwEffect
    Type: System.UInt32%
    [in, out] On input, the effect being requested. On output, the effect that your object list allows.

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 vsshell80.idl:

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

The environment calls 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.

.NET Framework Security

See Also

Reference

IVsSimpleObjectList2 Interface

IVsSimpleObjectList2 Members

Microsoft.VisualStudio.Shell.Interop Namespace