monthcalendar tooltip

daverage

Active member
Joined
Aug 29, 2006
Messages
26
Programming Experience
Beginner
Is there a way to get a tool tip for a date on a monthcalendar control??
 
Sure, the Monthcalendar got a useful HitTest method that will give you the Date in resultant HitTestInfo.Time property. Here is some code to get you started, try it out to see it will display tooltip of the date you move over with mouse:
VB.NET:
Dim prevdate As Date, tt As New ToolTip
 
Private Sub MonthCalendar1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles MonthCalendar1.MouseMove
  Dim hit As MonthCalendar.HitTestInfo = MonthCalendar1.HitTest(e.Location)
  If hit.Time <> prevdate Then
    tt.SetToolTip(sender, hit.Time.ToString)
    prevdate = hit.Time
  End If
End Sub
 
Back
Top