Sunday, March 23, 2008

Why isn't my TreeView showing drag images?

TreeView controls refuse to display drag images unless if they have been assigned a normal image list. This can be done with the macro TreeView_SetImageList.
HIMAGELIST TreeView_SetImageList(
HWND hwndTV, // handle to treeview
HIMAGELIST himl, // handle to image list containing icons
INT iImage // set this to TVSIL_NORMAL
If you don't want to see the icons in the TreeView, you can use blank icons in the image list. However, this still leaves you with a big empty space. You can shrink this space by reducing the dimensions specified for the icons in the image list, but this has the unfortunate side effect of shrinking the size of the expando buttons correspondingly.

No comments: