#include <GuiConstants.au3> #include <StaticConstants.au3> #include <GUICtrlSetOnHover_UDF.au3> ; Global $aSquere = 0 $hGUI = GUICreate("Test Script", 300, 200) $Label1 = GUICtrlCreateLabel("Label 1", 20, 40, -1, 20) _GUICtrlSetOnHover(-1, "Label_Hover_Proc", "Label_LeaveHover_Proc") $Label2 = GUICtrlCreateLabel("Label 2", 20, 70, -1, 20) _GUICtrlSetOnHover(-1, "Label_Hover_Proc", "Label_LeaveHover_Proc") $Label3 = GUICtrlCreateLabel("Label 3", 20, 100, -1, 20) _GUICtrlSetOnHover(-1, "Label_Hover_Proc", "Label_LeaveHover_Proc") GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func Label_Hover_Proc($iCtrlID) Local $aCtrlPos = ControlGetPos($hGUI, "", $iCtrlID) $aSquere = _GUICtrlCreateSquere($aCtrlPos[0]-3, $aCtrlPos[1]-3, $aCtrlPos[2], $aCtrlPos[3], 3, 0xFF0000) EndFunc Func Label_LeaveHover_Proc($iCtrlID) If IsArray($aSquere) Then For $i = $aSquere[1] To $aSquere[$aSquere[0]] GUICtrlDelete($i) Next $aSquere = 0 EndIf EndFunc Func _GUICtrlCreateSquere($iLeft, $iTop, $iWidth, $iHeight, $iLineWidth=3, $sColor=0) Local $aControlIDArray[5] $aControlIDArray[0] = 4 $aControlIDArray[1] = GUICtrlCreateLabel("", $iLeft, $iTop, $iWidth, $iLineWidth, $SS_SUNKEN) GUICtrlSetBkColor(-1, $sColor) $aControlIDArray[2] = GUICtrlCreateLabel("", $iLeft, $iTop, $iLineWidth, $iHeight, $SS_SUNKEN) GUICtrlSetBkColor(-1, $sColor) $aControlIDArray[3] = GUICtrlCreateLabel("", ($iLeft+$iWidth)-1, $iTop, $iLineWidth, $iHeight+2, $SS_SUNKEN) GUICtrlSetBkColor(-1, $sColor) $aControlIDArray[4] = GUICtrlCreateLabel("", $iLeft, ($iTop+$iHeight)-1, $iWidth+1, $iLineWidth, $SS_SUNKEN) GUICtrlSetBkColor(-1, $sColor) Return $aControlIDArray EndFunc |