Thanks for any info
Danny
>Look at CListCtrl::GetHeaderCtrl() and CHeaderCtrl::SetImageList and SetItem.
>You can display images on the column headers.
Note that the list control will not draw these images transparently,
so you'd bettern make them square or make the background color light
gray and cross your fingers that all of your users use standard
windows colors. For more info on this method, see:
http://www.codeguru.com/listview/image_in_header.shtml
http://www.codeguru.com/listview/imagelist_with_header.shtml
For an alternative, see a post I made today to
comp.os.ms-windows.programmer.win32 and
comp.os.ms-windows.programmer.tool.mfc with the subject "Re: Listview
problem". It does require custom drawing however.
>Danny Pressley wrote:
>
>> I have a CListCtrl derived class that allows sorting on columns when
>> in report view mode. Without doing an owner drawn CListCtrl, is there
>> any way to highlight or make an individual column header look
>> different. This will allow a visible distinction to the user for which
>> column the control is being sorted by.
>>
>> Thanks for any info
>> Danny
--
Chip
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
"Make it idiot-proof and someone will make a better idiot."
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Thanks any ways
Danny
Scot T Brennecke wrote:
> Look at CListCtrl::GetHeaderCtrl() and CHeaderCtrl::SetImageList and SetItem.
> You can display images on the column headers.
>
>I've already tried that. Some of the columns description text in the header don't
>leave enough room for an image to be on it also (the text gets chopped when an
>image is added), and I'm unable to widen the columns to make enough room.
>Otherwise, the image of an up or down arrow on the active sorting column would do
>it.
You stated in your original post that you don't want to make the list
control owner-drawn. What about the header control? You could fill
the background using a different color or make the text underlined
using an owner-drawn header control.
I was able to us the below line of code to make a minor visible column identifier. It
makes the left side of the column header turn to a dark blue color. But its definitely
not the correct solution.
I put this line of code in my sorting algorithm.
((CHeaderCtrl*)MyListCtrl.GetDlgItem(0))->SetHotDivider(nCol);
Thanks again
Danny
>After doing what research I could and seeing the responses from this thread, it looks
>like the only valid solution is to make an owner drawn control.
>
>I was able to us the below line of code to make a minor visible column identifier. It
>makes the left side of the column header turn to a dark blue color. But its definitely
>not the correct solution.
>
>I put this line of code in my sorting algorithm.
> ((CHeaderCtrl*)MyListCtrl.GetDlgItem(0))->SetHotDivider(nCol);
I think that making the background a different color, changing the
font or maybe underlining the column title are all good ways to
indicate the sort direction. You can do all of those by subclassing
the header control and making it owner drawn.
For an example of this, see
http://www.codeguru.com/listview/indicating_sort_order.shtml. This
article shows how to indicate the sort using an owner-drawn header
that displays a triangle in the sorted column header. However, you
can certainly adapt it easily to indicate the sorted column using one
of the methods I mentioned above.
Thanks for the advice and the URL.
Danny