Reputation: 9925
I am trying to figure out a way to refresh/update/redraw a list-control after its alignment style (LVS_ALIGNTOP
/ LVS_ALIGNLEFT
) has been changed.
If I change the style from icon/small mode to something else then back again, it works sometimes (only when clicking, programmatically changing doesn’t seem to work even with a delay). Even so, that is pretty kludgey at best (not to mention ugly/flickery) so I would prefer to find a better (more appropriate, more correct?) way.
I tried the list-control’s UpdateWindow
, RedrawWindow
, Invalidate
, RedrawItems
, Update
… nothing seems to work other than changing the display mode.
Upvotes: 2
Views: 4622
Reputation: 3124
Found out what you had to do,
m_listCtrl.Arrange(LVA_DEFAULT);
you might need to change LVA_DEFAULT
to your specific requirements. See this
Upvotes: 1
Reputation: 5475
I've successfully used the CListCtrl.Update() method to solve this issue.
ie:
for (int z=0;z<m_listCtrl.GetItemCount();z++)
{
m_listCtrl.Update(z);
}
Upvotes: 1