老板是否只画在报告模式下工作的ListView? [英] Does owner draw only work in report mode for ListView?

查看:200
本文介绍了老板是否只画在报告模式下工作的ListView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提请时左右在ListView处于图标模式下的ListView项的矩形,所以我就开始阅读关于所有者绘制,我认为这将解决我的问题。

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.

不过,我也看过了所有者绘制仅在报告模式下工作!这仍然是在Windows(Windows XP和更高版本)?

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)?

如果这仍是如此,则有另一种方式来绘制围绕ListView项的矩形?

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

推荐答案

LVS_OWNERDRAWFIXED 风格是唯一有意义的 LVS_REPORT 情况。但还有另一种方式 - 你可以处理的ListView送你 NM_CUSTOMDRAW 的通知。那些为所有控制模式发送,这取决于你想做的事,你可以处理 CDDS_ITEMPOSTPAINT 通知,使用什么 dwItemSpec 字段项指标,从WM_NOTIFY处理程序中发送LVM_GETITEMRECT,做任何你想用它。

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.

这篇关于老板是否只画在报告模式下工作的ListView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆