Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

ListBoxTooltip - A class for displaying items' values in a tooltip

Total Hit ( 1694)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


Click here to copy the following block
' --- The ListBoxTooltip class
'
' Usage in the client form:
'
'  Dim lstTT As New ListBoxTooltip
'
'  Private Sub Form_Load()
'    Set lstTT.ListBox = List1
'   End Sub
'  Private Sub Form_Unload(Cancel As Integer)
'    Set lstTT.ListBox = Nothing
'  End Sub

Public WithEvents ListBox As ListBox

Private Sub ListBox_MouseMove(Button As Integer, Shift As Integer, X As Single, _
  Y As Single)
  Dim oldFont As StdFont, itemIndex As Long
  
  ' since a listbox doesn't have a TextHeight method
  ' we must borrow it from its Parent
  With ListBox.Parent
    Set oldFont = .Font
    Set .Font = ListBox.Font
    ' determine which element the mouse is on
    itemIndex = Y \ .TextHeight("A") + ListBox.TopIndex
    ' restore fonts
    Set .Font = oldFont
  End With
  
  ' set the tooltip to the current item's string
  If itemIndex < ListBox.ListCount Then
    ListBox.ToolTipText = ListBox.List(itemIndex)
  Else
    ListBox.ToolTipText = ""
  End If

End Sub


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.