CImageList::BeginDrag

BOOL BeginDrag( int nImage, CPoint ptHotSpot );

Return Value

Nonzero if successful; otherwise 0.

Parameters

nImage

Zero-based index of the image to drag.

ptHotSpot

Coordinates of the starting drag position (typically, the cursor position). The coordinates are relative to the upper left corner of the image.

Remarks

Call this function to begin dragging an image. This function creates a temporary image list that is used for dragging. The image combines the specified image and its mask with the current cursor. In response to subsequent WM_MOUSEMOVE messages, you can move the drag image by using the DragMove member function. To end the drag operation, you can use the EndDrag member function.

Example

// The pointer to my image list.
extern CImageList* pmyImageList;
// A pointer to the window in which to drag the image.
extern CWnd* pmyWnd;
// The position of the cursor.
extern CPoint myPoint;

// Initialize the drag image (usually called from WM_LBUTTONDOWN).
pmyImageList->BeginDrag(0, CPoint(0, 0));
pmyImageList->DragEnter(pmyWnd, myPoint);

CImageList OverviewClass MembersHierarchy Chart

See Also   CImageList::Draw, CImageList::EndDrag, CImageList::DragMove