是否可以自定义绘制的ListViewGroup

是否可以自定义绘制的ListViewGroup

本文介绍了是否可以自定义绘制的ListViewGroup的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用.NET 2.0 System.Windows.Forms.ListView控制。我知道我可以设置在ListView为true OwnerDraw属性,然后覆盖到的OnDrawItem自定义绘制我ListViewItems。我还可以覆盖OnDrawColumnHeader和OnDrawSubItem绘制这些组件。

I am using the System.Windows.Forms.ListView control on .NET 2.0. I know I can set the OwnerDraw property on the ListView to true and then override OnDrawItem to custom draw my ListViewItems. I can also override OnDrawColumnHeader and OnDrawSubItem to draw those components.

然而,没有等价物OnDrawGroup的方法来覆盖,如果我想自定义绘制我ListViewGroups。

However, there is no equivalent "OnDrawGroup" method to override if I want to custom draw my ListViewGroups.

我把在这个消息控件使用简单的介绍一下,我看到有WM_CUSTOMDRAW和CDDS_ITEMPREPAINT通知,但我不知道有什么办法,如果我处理这些本地消息自定义绘制我ListViewGroups?

I took a brief look at the messages this control uses and I see there are WM_CUSTOMDRAW and CDDS_ITEMPREPAINT notifications, but I'm wondering is there a way if I handle these native messages to custom draw my ListViewGroups?

推荐答案

它只是不能这样做。

您无法自行绘制的一切去做,或者在下降 WM_CUSTOMDRAW ,甚至用处理的的使用)。在的ListView 组头很奇怪的野兽。在XP中,你最多只能设置它们的颜色(甚至没有自己的字体),但由于Vista中,有可以做,以他们绝对没有。

This discussion has come up several times (here for example). Group headers in a ListView are strange beasts. In XP, you could at most set their color (not even their font), but since Vista, there is absolute nothing you can do to them.

这篇关于是否可以自定义绘制的ListViewGroup的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 17:02