- Private lastdate As New Date(1, 1, 1)
- 'MC c'est le contrôle MonthCalendar
- 'MouseMove c'est quand on bouge la souris !
- Private Sub ShowToolTip(ByVal MC As MonthCalendar, ByVal e As System.Windows.Forms.MouseEventArgs)
- Dim ht As MonthCalendar.HitTestInfo = MC.HitTest(e.X, e.Y)
- Select Case ht.HitArea
- 'check to see if the pointer hover above a date
- Case MonthCalendar.HitArea.Date
- 'prevent tooltip from displaying more than one baloon due to the mousemove's nature
- If lastdate <> ht.Time Then
- With ToolTip1
- 'display tooltip message
- .IsBalloon = False
- .ToolTipTitle = ht.Time.ToString("dd-MM-yyyy")
- .Show(ht.Time.ToString("dd-MM-yyyy"), MC)
- End With
- lastdate = ht.Time
- End If
- Case Else
- 'if the pointer doesn't hover above a date then we'll hide the tooltip
- With ToolTip1
- .Hide(MC)
- End With
- End Select
- End Sub