Détermine la partie du contrôle calendrier mensuel où se trouve un point donné
#include <GuiMonthCal.au3>
_GUICtrlMonthCal_HitTest ( $hWnd, $iX, $iY )
$hWnd | ID ou handle du contrôle Month Calendar |
$iX | Position X à tester |
$iY | Position Y à tester |
#include <GUIConstantsEx.au3> #include <GuiMonthCal.au3> #include <WinAPIMisc.au3> #include <WindowsConstants.au3> Global $g_idMonthCal, $g_idMemo, $g_hGUI, $iMsg Example() Func Example() ; Crée une GUI $g_hGUI = GUICreate("Month Calendar Hit Test", 400, 300) $g_idMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000) ; Crée un contrôle memo $g_idMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, $WS_VSCROLL) GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New") GUISetState(@SW_SHOW) ; Boucle jusqu'à ce que l'utilisateur quitte. Do $iMsg = GUIGetMsg() If $iMsg = $GUI_EVENT_MOUSEMOVE Then DoHitTest() Until $iMsg = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example ; Effectue le test Func DoHitTest() Local $tHit $tHit = _GUICtrlMonthCal_HitTest($g_idMonthCal, _WinAPI_GetMousePosX(True, $g_hGUI), _WinAPI_GetMousePosY(True, $g_hGUI)) If BitAND(DllStructGetData($tHit, "Hit"), $MCHT_CALENDARDATE) <> 0 Then MemoWrite("Date: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tHit, "Month"), _ DllStructGetData($tHit, "Day"), _ DllStructGetData($tHit, "Year"))) EndIf EndFunc ;==>DoHitTest ; Ecrit un message dans le contrôle memo Func MemoWrite($sMessage) GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite