Does owner draw only work in report mode for ListView?

拟墨画扇 提交于 2019-12-23 19:56:27

问题


I want to draw a rectangle around a ListView item when the ListView is in Icon mode, so I started reading about owner draw which I thought that it will solve my problem.

However, I have also read that owner draw only works in Report mode! Is this still the case under newer versions of Windows (Windows XP and later)?

And if this is still the case, then is there another way to draw a rectangle around a ListView item?


回答1:


Yes, LVS_OWNERDRAWFIXED style is only meaningful for LVS_REPORT case. But there's another way - you can process NM_CUSTOMDRAW notifications that listview sends you. Those are sent for all control modes, and depending on what you want to do you can handle CDDS_ITEMPOSTPAINT notification, use dwItemSpec field as item index, send LVM_GETITEMRECT from within your WM_NOTIFY handler, and do whatever you want with it.



来源:https://stackoverflow.com/questions/36442894/does-owner-draw-only-work-in-report-mode-for-listview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!