I’ve created new Windows Forms Application (C#) with one simple form containing ListView. Then I have changed the View Property to Details and increased the size of the font used in this ListView and here’s the result:
This is how it looks on Windows XP with Windows Classic theme:

and here’s the result with Windows XP theme:

I can prevent the appearance of my application to be affected by Visual Styles either by removing Application.EnableVisualStyles() call or by changing the
Application.VisualStyleState:

Although this change makes the ListView to have the desired appearance, it also affects the appearance of other controls. I’d like my ListView to be the only control that is not affected by Visual Styles.
I’ve also found similar questions that try to deal with it:
Can you turn off visual styles/theming for just a single windows control?
How do I disable visual styles for just one control, and not its children?
Unfortunately, none of mentioned solutions works. It looks like the header itself would be made up of some controls that are affected by visual styles even when visual styles for ListView control are disabled.
Any C# solution that would prevent visual styles from affecting the appearance of the ListView header would be appreciated.
After exhausting research, I found it out. The thing is that when you call
within custom
ListViewclass, it prevents visual styles from affecting the appearence of theListViewcontrol but not theListViewheader control (SysHeader32window), which is child window ofListView. So when calling theSetWindowThemefunction, we need to provide the handle of the header window instead of the handle of the ListView: