Set "HeaderUsesThemes" to false and "DrawUnthemedBackground()" in
HeaderControl.cs gets hit for each column. If you use HotItem you can't NOT
select a row. There's no place for the mouse to go.
If you set the rightmost column FillsFreeSpace to false so that an empty
margin to the right appears and mouse movement is ignored again (allowing you
to deselect items), then a themed header appears to the right all over again.
Pick your poison. I tried to fix it with column visibility, with mouse events,
by setting FullRowSelect to false. These just create more problems.
It works the way I want in Explorer. Notice in Explorer there is a dead column
to the right where rows can be deselected, where the mouse cannot select an
item. And there are headers on top of each active column where they are
expected, yet there is no rubbish column header above the dead column.
I don't see any way to fix this but to just overdraw in space where the themed
header is appearing, where a header for the dead column is, from within
"DrawUnthemedBackground()" in HeaderControl.cs everytime it gets hit.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I may have expected too much from the HeaderControl class. It doesn't really
do much more than owner drawing the column headers using the DrawColumnHeader
event. Maybe it provides more control in places, not sure.
This issue is old and it really belongs to the ListView control. People call
it by different names. Sometimes it is called a space filling column, and the
problem is you can't owner draw it. You can owner draw the column headers, but
that's all. So, I don't know why anyone would even do this because it looks
worse - your headers are custom, but then there is that stupid space filling
header to the right that you can't touch. You might as well stick with the
themed background. And if MS decides the theme should be pink bows against a
green background, then that will be imposed on your design. If you want to do
this right I would consider a rewrite from scratch. A wrapper will never do
this.
BTW I think the cookbook refers to a IsSpaceFilling column property. You won't
find it in the latest build. Look for FillsFreeSpace instead.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here is a quick and dirty solution to the space filling column issue. If you
want to hide it altogether, right dock a panel in the OLV with the same
background color as the OLV. Subscribe to the OLV's ColumnWidthChanging event
and there make the hiding panel width equal to the OLV width minus the total
column widths. Seems like a tacky solution, but it works better than I
expected.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Set "HeaderUsesThemes" to false and "DrawUnthemedBackground()" in
HeaderControl.cs gets hit for each column. If you use HotItem you can't NOT
select a row. There's no place for the mouse to go.
If you set the rightmost column FillsFreeSpace to false so that an empty
margin to the right appears and mouse movement is ignored again (allowing you
to deselect items), then a themed header appears to the right all over again.
Pick your poison. I tried to fix it with column visibility, with mouse events,
by setting FullRowSelect to false. These just create more problems.
It works the way I want in Explorer. Notice in Explorer there is a dead column
to the right where rows can be deselected, where the mouse cannot select an
item. And there are headers on top of each active column where they are
expected, yet there is no rubbish column header above the dead column.
I don't see any way to fix this but to just overdraw in space where the themed
header is appearing, where a header for the dead column is, from within
"DrawUnthemedBackground()" in HeaderControl.cs everytime it gets hit.
I may have expected too much from the HeaderControl class. It doesn't really
do much more than owner drawing the column headers using the DrawColumnHeader
event. Maybe it provides more control in places, not sure.
This issue is old and it really belongs to the ListView control. People call
it by different names. Sometimes it is called a space filling column, and the
problem is you can't owner draw it. You can owner draw the column headers, but
that's all. So, I don't know why anyone would even do this because it looks
worse - your headers are custom, but then there is that stupid space filling
header to the right that you can't touch. You might as well stick with the
themed background. And if MS decides the theme should be pink bows against a
green background, then that will be imposed on your design. If you want to do
this right I would consider a rewrite from scratch. A wrapper will never do
this.
BTW I think the cookbook refers to a IsSpaceFilling column property. You won't
find it in the latest build. Look for FillsFreeSpace instead.
Here is a quick and dirty solution to the space filling column issue. If you
want to hide it altogether, right dock a panel in the OLV with the same
background color as the OLV. Subscribe to the OLV's ColumnWidthChanging event
and there make the hiding panel width equal to the OLV width minus the total
column widths. Seems like a tacky solution, but it works better than I
expected.