RobEmDee Posted June 16, 2005 Posted June 16, 2005 I am using the IndexFromPoint() method of the ListBox inside of the MouseMove event handler to identify which ListBox item a user's mouse is hovering over at any given point. This has worked well. The one annoyance I have found is that when the mouse is over empty ListBox space below the last ListBox item, IndexFromPoint() returns the index of the last ListBox item even though technically the mouse is not over any items. Does anyone have a quick workaround for this? Thanks. Quote
APaule Posted June 16, 2005 Posted June 16, 2005 The one annoyance I have found is that when the mouse is over empty ListBox space below the last ListBox item' date=' IndexFromPoint() returns the index of the last ListBox item even though technically the mouse is not over any items.[/quote'] :confused: Sure? I tied it out and when the cursor enters the space below the last item IndexFromPoint() returns -1 (even when the mouse enters the listbox on white space)! The only problem you might experience is, when the last item is right above the lower border of the box or if the mouse leaves the listbox on the left, right or top. Then the event is not triggered and if you store the index in a variable, it holds the index of the last item you hovered over. This could easily be solved with the MouseLeave event. Quote
RobEmDee Posted June 18, 2005 Author Posted June 18, 2005 APaule: Thanks for taking a look. I realize now that I am only experiencing the behavior I described with ListBoxes that I have taken ownership of the drawing (DrawMode = OwnerDrawVariable). Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.