Partager via


CTreeCtrl::CreateDragImage

Call this function to create a dragging bitmap for the given item in a tree view control, create an image list for the bitmap, and add the bitmap to the image list.

CImageList* CreateDragImage(
   HTREEITEM hItem 
);

Parameters

  • hItem
    Handle of the tree item to be dragged.

Return Value

Pointer to the image list to which the dragging bitmap was added, if successful; otherwise NULL.

Remarks

An application uses the image-list functions to display the image when the item is being dragged.

The CImageList object is permanent, and you must delete it when finished. For example:

HTREEITEM hItem =m_TreeCtrl.GetSelectedItem();

CImageList* pImageList = m_TreeCtrl.CreateDragImage(hItem);

// Do something with the image list.

delete pImageList;

Requirements

Header: afxcmn.h

See Also

Concepts

CTreeCtrl Class

CTreeCtrl Members

Hierarchy Chart

CTreeCtrl::SelectDropTarget

CTreeCtrl::GetDropHilightItem

CTreeCtrl::SetImageList