SHDRAGIMAGE structure (shobjidl_core.h)

Contains the information needed to create a drag image.

Syntax

typedef struct SHDRAGIMAGE {
  SIZE     sizeDragImage;
  POINT    ptOffset;
  HBITMAP  hbmpDragImage;
  COLORREF crColorKey;
} SHDRAGIMAGE, *LPSHDRAGIMAGE;

Members

sizeDragImage

Type: SIZE

A SIZE structure with the length and width of the drag image.

ptOffset

Type: POINT

A POINT structure that specifies the location of the cursor within the drag image. The structure should contain the offset from the upper-left corner of the drag image to the location of the cursor.

hbmpDragImage

Type: HBITMAP

The drag image's bitmap handle.

crColorKey

Type: COLORREF

The color used by the control to fill the background of the drag image.

Remarks

In Windows Vista this structure is defined in Shobjidl.idl. Prior to that, it was defined in Shlobj.h.

Use the following procedure to create the drag image.

  1. Create a bitmap of the size specified by sizeDragImage with a handle to a device context (HDC) that is compatible with the screen.
  2. Draw the bitmap.
  3. Select the bitmap out of the HDC it was created with.
  4. Destroy the HDC.
  5. Assign the bitmap handle to hbmpDragImage.
Note  Turn off antialiasing when drawing text. Otherwise, artifacts could occur at the edges, between the text color and the color key.
 

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional with SP3, Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Header shobjidl_core.h (include Shobjidl.h)

See also

IDragSourceHelper::InitializeFromBitmap

IDragSourceHelper::InitializeFromWindow