Posted By

kat on 08/07/10


Tagged

tooltip ListBox


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Tyster


tooltips on list box


 / Published in: C#
 

  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  

You need to login to post a comment.