c# - Change color of groups in ObjectListView

2019-07-01 20:08发布

问题:

When building groups in ObjectListView, how do I change the color of the group? In default groups are shown with a dark blue line in dark blue forecolor. How can I change it?

回答1:

Its apparently not possible. There was a discussion about the ability to change the group header font/style several years ago. I don't know if that still represents the actual situation, but I wasn't able to come up with a solution when I was looking for it several weeks ago.

Even using the undocumented ListView API's, there is no mechanism to change anything about how a group header is rendered. You can't change the font, color, background color, anything.

Well, under XP only, you can change the color of the group header (via the SetGroupMetrics message). But under Vista and later, that ability was removed.