Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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.
Posted
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.
Posted

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).

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...