jameswelle
jameswelle

Reputation: 1397

Is it possible to custom draw a ListViewGroup

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.

However, there is no equivalent "OnDrawGroup" method to override if I want to custom draw my 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?

Upvotes: 6

Views: 3404

Answers (2)

Grammarian
Grammarian

Reputation: 6882

It just can't be done.

You can't do it by drawing everything yourself, or by dropping down to handle WM_CUSTOMDRAW or even by using the undocumented ListView interfaces and used here.

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.

Upvotes: 2

Joel Lucsy
Joel Lucsy

Reputation: 8706

I don't believe this is possible using the built-in mechanism. I think you'd have to drawing everything yourself.

Upvotes: 2

Related Questions