tooltips on list box


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  1. private void OnListBoxMouseMove(object sender, MouseEventArgs e)
  2. {
  3. int itemIndex = -1;
  4.  
  5. if (m_LinksListBox.ItemHeight != 0)
  6. {
  7. itemIndex = e.Y / m_LinksListBox.ItemHeight;
  8. itemIndex += m_LinksListBox.TopIndex;
  9. }
  10.  
  11. if ((itemIndex >= 0) && (itemIndex < m_LinksListBox.Items.Count))
  12. {
  13. ILink mouseOveredLink =
  14. (m_LinksListBox.Items[itemIndex] as LinkListItem).Link;
  15.  
  16. if (mouseOveredLink != null)
  17. {
  18. if (!ListBoxToolTip.GetToolTip(m_LinksListBox).Equals(mouseOveredLink.FileName))
  19. {
  20. ListBoxToolTip.SetToolTip(m_LinksListBox, mouseOveredLink.FileName);
  21. }
  22. return;
  23. }
  24. }
  25.  
  26. ListBoxToolTip.Hide(m_LinksListBox);
  27. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.