I created a list view class that uses Custom Draw for its rendering. It all works well except that it doesn't render anything. I subclassed its parent window to catch the NM_CUSTOMDRAW
notification as a WM_NOTIFY
message. However, it appears that WM_NOTIFY
is only triggered a few times during creation of the control and never again after that. So the NM_CUSTOMDRAW
code is never executed.
I checked with Winspector Spy so see if the control is laid out correctly in the parent window and that seems to be fine.
Does anyone have a clue about what I may be doing wrong?
The code can be found online:
Why are you drawing text in CDDS_ITEMPOSTPAINT? You should probably draw your text in CDDS_ITEMPREPAINT and return CDRF_SKIPDEFAULT. Also, you should not use the rect in NMCUSTOMDRAW, call ListView_GetItemRect to get the rect you are really after (LVIR_LABEL for text etc)
看起来您使用的不是LVS_OWNERDRAWFIXED
样式,这可以解释为什么您没有获得所有者绘制的消息。
I needed to call ShowWindow(mHandle, SW_SHOW);
after creating the list view.
Doh!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.