Click to See Complete Forum and Search --> : Set ToolTip for ListView
SargumSingh
Sep 15th, 2000, 10:31 PM
Is there way to capture what cell of ListView the mouse is on and then display the tooltip displaying the data of that
cell. Actually you can strech the cell to see the data but since data is too long i want to use tool tip to display the whole string.
Thanks!
Use the ListView's ToolTipText and SelectedItem properties to display the item that the mouse is over (but, it has to be selected).
Private Sub ListView1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
ListView1.ToolTipText = ListView1.SelectedItem
End Sub
Achichincle
Jan 9th, 2002, 06:37 PM
I needed to only display the tooltip if the mouse was over the selected item, though, so as to simulate normal tooltip behavior.
This is what I came up with...
In item in a ListView (lvwList type) appears to be approximately 210 units high.
Private Sub ListView1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If (y > (ListView1.SelectedItem.Index * 210 + 60) And (ListView1SelectedItem.Index * 210 + 270) Then
ListView1.ToolTipText = ListView1.SelectedItem
Else
ListView1.ToolTipText = ""
End If
End Sub
The 60 is an offset to account for the header row.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.