OnDrawColumnHeader and LIstView

  • Thread starter Thread starter --== Alain ==--
  • Start date Start date
A

--== Alain ==--

Hi,

I have some little issue when i want to redraw the columnHeader of my
ListView.
Basically i display a little arrow to show the sortOrder of each column.
For sure only the clicked column is sorted.

here is my code located in OnDrawColumnHeader overriden method:
....
if(e->ColumnIndex == this->m_LastClickedColumn)
{
if (this->Sorting == SortOrder::Ascending)
{
e->Graphics->DrawString("t", ArrowFont,
System::Drawing::SystemBrushes::ControlDarkDark, arrowRect, strForm);
}
else if (this->Sorting == SortOrder::Descending)
{
e->Graphics->DrawString("u", ArrowFont,
System::Drawing::SystemBrushes::ControlDarkDark, arrowRect, strForm);
}
}
else
{
e->Graphics->DrawString(" ", ArrowFont,
System::Drawing::SystemBrushes::ControlDarkDark, arrowRect, strForm);
}
....

unfortunately, the arrow is drawn correctly in the clicked column, but
if arrow was drawn in some other column, it does not disappear after 1
click...

for example :

i click column header 2 (arrow is on column header 2)
i click column header 1 (arrow is on column header 1 and still drawn on
column header 2)
i click again on column header 1 (arrow only appear on column header 1
and nowhere else)...

where could be the problem ?
I have the feeling that component does not redraw all column
headers...but only the ones which are close to the one i clicked..

Alain
 
I have some little issue when i want to redraw the columnHeader of my
ListView.
Basically i display a little arrow to show the sortOrder of each column.
For sure only the clicked column is sorted.

Alain,

Is there any reason other than the image that you're drawing things
this way?

The header control supports an image facility (HDF_IMAGE) that will
let you achieve the normal sorted column indicator fairly easily
(without trying to draw it yourself anyway).

Dave
 
i also place the text of header with Graphics method also.. to adjust it
on right, left or center..

You can position the image with HDF_BITMAP_ON_RIGHT (or not).

And there are specific HDF_SORTDOWN & HDF_SORTUP on the XP (v6)
controls.

Anyhow, if you know that won't do what you need, it was just a
suggestion to side-step the problems you're having.

Dave
 
Back
Top