Share via


Visual Basic: Windows Controls

HitTest Method (MonthView Control)

See Also   Example   Applies To

Returns the date located at a particular set of coordinates. Most often used with drag-and-drop operations to determine if a drop target item is available at the present location.

Syntax

object.**HitTest(**x as Single, y As Single, Date As Date)

The HitTest method syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
x, y Coordinates of a target date.
Date A date expression returned when a mouse operation occurs over a date on the control.

Return Settings

The HitTest method returns the following values which specify the part of the calendar over which the mouse pointer is hovering:

Constant Value Description
mvwCalendarBack 0 The calendar background.
mvwCalendarDate 1 Calendar date.
mvwCalendarDateNext 2 When this area is clicked, the calendar displays the following month.
mvwCalendarDatePrev 3 When this area is clicked, the calendar displays the previous month.
mvwCalendarDay 4 The day labels above the dates.
mvwCalendarWeekNum 5 The week number, if ShowWeekNumbers is set to True.
mvwNoWhere 6 Bottom edge of the calendar.
mvwTitleBack 7 Background of the calendar.
mvwTitleBtnNext 8 The Next button in the title area.
mvwTitleBtnPrev 9 The Previous button in the title area.
mvwTitleMonth 10 The month string in the title.
mvwTitleYear 11 The year string in the title.
mvwTodayLink 12 When this area is clicked, the calendar displays the current month and day. Only available if ShowToday is set to True.

Remarks

The HitTest method can be used to determine what area of the calendar is being affected by a mouse operation.

If no date exists at the specified coordinates, the HitTest method returns Null. The Date will also be Null if no date exists at the coordinates.