Providing Drag-and-Drop Support for Header Items

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Providing Drag-and-Drop Support for Header Items.

To provide drag-and-drop support for header items, specify the HDS_DRAGDROP style. Drag-and-drop support for header items gives the user the ability to reorder the header items of a header control. The default behavior provides a semitransparent drag image of the header item being dragged and a visual indicator of the new position, if the header item is dropped.

As with common drag-and-drop functionality, you can extend the default drag-and-drop behavior by handling the HDN_BEGINDRAG and HDN_ENDDRAG notifications. You can also customize the appearance of the drag image by overriding the CHeaderCtrl::CreateDragImage member function.

Note

If you are providing drag-and-drop support for an embedded header control in a list control, see the Extended Style section in the Changing List Control Styles topic.

See Also

Using CHeaderCtrl