How do I un-highlight a previously selected line in an MFC CListCtrl programmatically (VS 6)?

StackOverflow https://stackoverflow.com/questions/1578581

  •  21-09-2019
  •  | 
  •  

Question

Does anyone know how to un-highlight a previously selected line in an MFC CListCtrl programmatically ?

Was it helpful?

Solution

To de-select the 20th item:

YourListCtrl.SetItemState(20, 0, LVIS_SELECTED);

OTHER TIPS

Well, it doesn't work if the the List view is Report style ie multiple columns. Do you have any solution for that?

One can set the List property as:

m_ctlList.SetExtendedStyle(LVS_EX_FULLROWSELECT);

which always selects the particular line when user clicks on that line, but if programmer deletes a line in the list view, the next row replaces the selected one and the row is un-highlighted.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top