Dragging the Tree-View Item
You drag a tree-view item by calling the
ImageList_DragMove function when the parent window receives a
WM_MOUSEMOVE message, as the following example shows. The example also performs hit
testing during the drag operation to determine whether to highlight other items in
the tree view as targets of a drag and drop operation.
// Main_OnMouseMove - drags an item in a tree-view control,
// highlighting the item that is the target.
// hwndParent - handle of the parent window
// hwndTV - handle of the tree-view control
// xCur and yCur - x- and y-coordinates of the mouse cursor
- oid Main_OnMouseMove(HWND hwndParent, HWND hwndTV, LONG xCur, LONG yCur)
{
HTREEITEM htiTarget; // handle of target item
TV_HITTESTINFO tvht; // hit test information
if (g_fDragging) {
// Drag the item to the current position of the mouse cursor.
ImageList_DragMove(xCur, yCur);
// Find out if the cursor is on the item. If it is, highlight
// the item as a drop target.
tvht.pt.x = xCur;
tvht.pt.y = yCur;
if ((htiTarget = TreeView_HitTest(hwndTV, &tvht)) != NULL) {
TreeView_SelectDropTarget(hwndTV, htiTarget);
}
}
return;
}
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database