How would it be possible to create a 'FlatStyle' button for the columnheader of a listview in C#? I have researched this a little and I came across this code for VB: http://www.freevbcode.com/ShowCode.asp?ID=426
I am not sure how I could do this in C#, and I would also like to know if there is a better way of doing this.
Thanks!
That code dates back to before Vista and no longer works with the new Vista visual style for header controls. You will also need to turn off visual style rendering. It also won't work in 64-bit mode, common these days. Yet another side-effect is that the user no longer gets visual feedback when hovering the column header, an inevitable side-effect of turning off the HDS_BUTTON style flag.
Anyhoo, here's code that makes the headers look flat. Add a new class to your project and paste the code shown below. Compile. Drop the new control from the top of the toolbox onto your form.