'In a solution .......................................... (named StaBut)
'In a usercontrol ....................................... (named ctlStaBut)
'Choose a Tooltip control in the toolbox ................ (tltStaBut)
'...
'To have a tooltip when the mouse goes over a control ... (picStaBut)
Public Class ctlStaBut
Inherits System.Windows.Forms.UserControl
Implements IButtonControl
...
Public Sub New()
MyBase.New()
InitializeComponent()
...
Private tltTxt As String
Private shwTlt As Boolean
tltTxt = "Try this..."
shwTlt = True
End Sub
#Region " Properties -------------------------------------------------------- "
'...
Public Property SetTltText() As String
Get
Return tltTxt
End Get
Set(ByVal Value As String)
tltTxt = Value
Invalidate()
End Set
End Property
<System.ComponentModel.DefaultValue(True)> _
Public Property ToolTipActive() As Boolean
Get
Return shwTlt
End Get
Set(ByVal Value As Boolean)
shwTlt = Value
Invalidate()
End Set
End Property
'...
#End Region
Private Sub SetMseOver()
'...
'Set up the delays for the ToolTip.
If shwTlt Then
' AutoPopDelay property determines the length of time the ToolTip string is shown.
'tltStaBut.AutoPopDelay = 100
' The InitialDelay property determines how long the user must point at the
' associated control for the ToolTip string to appear.
tltStaBut.InitialDelay = 20000
' The ReshowDelay property sets the number of milliseconds it takes for subsequent ToolTip strings to appear as the mouse moves from one ToolTip-associated control to another.
tltStaBut.ReshowDelay = 0
' Force the ToolTip text to be displayed whether or not the form is active.
tltStaBut.ShowAlways = False
' Set up the ToolTip text.
tltStaBut.SetToolTip(picStaBut, tltTxt)
End If
'...
End Sub
End Class
'--------------------------------------------------------------------------
Public Class Form1
Inherits System.Windows.Forms.Form
'...
'...
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim stBu1 As New StaBut1.ctlStaBut()
'...
Me.Controls.Add(stBu1)
stBu1.SetTltText = "I have found it..."
stBu1.ToolTipActive = True
End Sub
'...
End Class
'I hope you can do something with this... Let me know...