S
sgrm123
Guest
Hi,
As per this link https://www.codeproject.com/articles/27774/clistctrl-and-sorting-rows, in CListCtrl, if we call below lines in the oncolumnclick() event of clistctrl I am getting sort arrow image in the top center of the header. If I call similar code in the columnclick for CMFCListCtrl I am getting sort arrow at the right of the column header only not at the center.
#if (_WIN32_WINNT >= 0x501)
for(int i = 0; i < GetHeaderCtrl()->GetItemCount(); ++i)
{
HDITEM hditem = {0};
hditem.mask = HDI_FORMAT;
VERIFY( GetHeaderCtrl()->GetItem( i, &hditem ) );
hditem.fmt &= ~(HDF_SORTDOWN|HDF_SORTUP);
if (i == colIndex)
{
hditem.fmt |= ascending ? HDF_SORTDOWN : HDF_SORTUP;
}
VERIFY( CListCtrl::GetHeaderCtrl()->SetItem( i, &hditem ) );
}
#endif
CMFCListCtrl
How to get sort arrow image at the top center of column header in the CMFCListCtrl?
Continue reading...
As per this link https://www.codeproject.com/articles/27774/clistctrl-and-sorting-rows, in CListCtrl, if we call below lines in the oncolumnclick() event of clistctrl I am getting sort arrow image in the top center of the header. If I call similar code in the columnclick for CMFCListCtrl I am getting sort arrow at the right of the column header only not at the center.
#if (_WIN32_WINNT >= 0x501)
for(int i = 0; i < GetHeaderCtrl()->GetItemCount(); ++i)
{
HDITEM hditem = {0};
hditem.mask = HDI_FORMAT;
VERIFY( GetHeaderCtrl()->GetItem( i, &hditem ) );
hditem.fmt &= ~(HDF_SORTDOWN|HDF_SORTUP);
if (i == colIndex)
{
hditem.fmt |= ascending ? HDF_SORTDOWN : HDF_SORTUP;
}
VERIFY( CListCtrl::GetHeaderCtrl()->SetItem( i, &hditem ) );
}
#endif
CMFCListCtrl
How to get sort arrow image at the top center of column header in the CMFCListCtrl?
Continue reading...