property Calendar.DateFromPoint (X as OLE_XPOS_PIXELS, Y as OLE_YPOS_PIXELS) as Date
Retrieves the date from point.

 TypeDescription 
   X as OLE_XPOS_PIXELS A single expression that indicates the X position in client coordinate  
   Y as OLE_YPOS_PIXELS A single expression that indicates the Y position in client coordinate  
   Date 0 or a DATE expression that indicates the date from point (X,Y)  

Use the DateFromPoint property to get the date from the cursor.

The following sample shows how to print the date over the cursor:

Private Sub Calendar1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim d As Date
    d = Calendar1.DateFromPoint(X / Screen.TwipsPerPixelX, Y / Screen.TwipsPerPixelY)
    If d <> 0 Then
        Debug.Print FormatDateTime(d)
    End If
End Sub

Send comments on this topic.
© 1999-2006 Exontrol Inc, Software. All rights reserved.