Reference > TDBCalendar Control > TDBCalendar Control Methods > DateFromPnt Method (TDBCalendar) |
Returns the date corresponding to the position indicated by coordinates. The DateFromPnt method returns a date value containing the specified coordinate pair.
TDBCalendar.DateFromPnt (X, Y)
X and Y are single-precision integer expressions that define a coordinate pair in pixels.
A Variant (Date) corresponding to the date beneath the specified coordinate(X, Y) pair. If either the X or the Y argument is outside of the calendar's day portion, this method returns Null.
This method is useful when working with mouse and drag events, when you are trying to determine where the user clicked or dropped another control in the calendar.
You must convert the X and Y arguments to pixels, even if the container's ScaleMode setting specifies a different unit of measurement.
The X and Y arguments are applied using the top-left of the control as the origin (0,0). If the trailing days are displayed (ShowTrailing property set to True), these days will also correspond to the position indicated by the specified coordinates. If not, this method will return Null.