开发者

MFC/WIN32: mouse hover highlight in listctrl

The ListView control of Windows Explorer gives a highlight to whatever item is under the mouse, without affecting the current selection. This helps enormously with relating what item a given tooltip applies to within a listview - especially in report mode.

However, I am currently unable to find any AP开发者_JS百科Is that would give my MFC application's CListCtrl that same behavior. Extended styles only have LVS_EX_TRACKSELECT, which actually alters the current selection (yuck!).

Does anyone know how to provide a standard CListCtrl (or whatever that actually sits on top of) the mouse-hot-tracking capability?

I found some articles on how to provide per cell and per row tooltip text, but its hard to tell what the tooltips relate to without something highlighting...


You can set the explorer theme to your list control. That way it will get a nicer look and you will also get the highlighting you want:

SetWindowTheme(hListControl, L"Explorer", NULL);


Include an extended style of LVS_EX_TWOCLICKACTIVATE or LVS_EX_ONECLICKACTIVATE. This is referred to as "hot tracking" (as opposed to hot track selection). http://msdn.microsoft.com/en-us/library/bb774732%28VS.85%29.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜