If you left click on a line item in a listbox it selects the item. Clicking the right mouse button is detectable in the listbox but does not select the item. Is there a way to override this listbox behaviour and select an item with the right mouse button?
I was having a problem determining which item was being selected when the right mouse button was clicked in the listbox control but solved that by adding the listbox.TopIndex with the Y mouse position divided by the selected item's height. This gave me the item that was clicked by the right mouse button so I could assign the SelectedIndex. Thanks for your input.
It's working great even when scrolled down. The listbox.TopIndex property gives the correct index of the first visible item in the list even after scrolling. Knowing that I could correctly deduce from the mouse position which item was being selected. I now have right click delete capability in my custom control combo box. I'm happy.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.