HardySpicer said:
I have a listbox with a list of commands. When I put the mouse over
each element I want a small text box to pop-up with help commands. I
dont' want to click the mouse - just overlay it.
You are talking about tool tips.
Here is a function to add to your form class:
Private _tip As New System.Windows.Forms.ToolTip()
Public Sub DynoTip( _
ByVal sender As System.Object, _
Byval Title as String, _
Byval text as string)
' Set up the delays for the ToolTip.
_tip.AutoPopDelay = 15000
_tip.InitialDelay = 1000
_tip.ReshowDelay = 500
_tip.UseFading = True
_tip.ShowAlways = True
_tip.ToolTipTitle = title
_tip.Show(text, _
sender, _
New System.Drawing.Point(0, sender.Height), 5000)
End Sub
Usage:
DynoTip(sender, "My Title", "text in box")
now, the trick for what you want is to probably going to require a
MouseHover or MoustCaptureChanged event over the listbox or as I just
tried the SelectedIndexChanged event with a CheckedListBox:
Private Sub CheckedListBox1_SelectedIndexChanged( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles _
CheckedListBox1.SelectedIndexChanged
Dim i As Integer = CheckedListBox1.SelectedIndex
If i >= 0 Then
Dim title As String = _
CheckedListBox1.Items().Item(i).ToString
BalloonTipIcon1.DynoTip(sender, title, _
"help for " + title)
End If
End Sub
If you want it to just to hover without any select, then you have to
play with the MouseHover and I can imagine that will be alittle tricky
to work out the IN/OUT timing.
That should get your started to fine tune it.
--