1

I am having a difficult time figuring out how to highlight Rows in a ListView Control when the control is NOT in focus. This control will rarely be in Focus as it's purpose is to show the user what Text Object Control is currently selected OR to select a Text Object by selecting it from within the ListView. This is working perfectly. It's the color of the selected item that is the issue. So many answers on the web I have found are setting the Focus of the control using something similar to Control.Select() however I don't want this control to be in focus and I don't care about the state of the control.

This issue began when I wanted to produce an output with more detail than I can create using a ListBox Control and after reading many recommendations to use a ListView Control I figured I'd update my code to use a ListView instead.

enter image description here

This isn't a question as to how to select an item in code. This is how to keep the control from updating the selected items BackColor and Font Color. I really just want it to be just like the ListBox.

The below line simply gives the selected item a light grey BackColor from what I can tell.

ListView.Items(0).Selected = True

Basically, I just want the selected row to look exactly as it does when I 'Click' on it.

enter image description here

So lastly, if I click on an item with the mouse and click/select any other object the Selected items turns a light grey color.

Code Novice
  • 2,043
  • 1
  • 20
  • 44
  • 1
    `HideSelection = false;` But if you want to keep the color the same for focus vs non-focus, you would have to dig into the OwnerDraw world. – LarsTech Oct 11 '18 at 20:19
  • I do have the HideSelection set to False however the behavior of the ListView Contol is as I have described. – Code Novice Oct 11 '18 at 20:33
  • @LarsTech Thank you for finding that wonderful Q&A duplicate question. I have googled so many of the googles using varying descriptions of my issue. That Stackoverflow question/answer did not appear in my searches but it's perfect. – Code Novice Oct 11 '18 at 21:17

0 Answers0