replerk1334
15-08-2014, 17:21
Здравствуйте !
Как указать событие изображению чтобы при нажатии или наведении курсора выполнялась смена того самого изображения на другое указанное изображение ?
madmasles
15-08-2014, 18:03
Как указать событие изображению »Что это за изображение?
replerk1334
15-08-2014, 18:30
madmasles, в качестве изображения использую стандартную иконку в формате .ico .
madmasles
15-08-2014, 19:18
replerk1334,
Пример: #include (http://autoit-script.ru/autoit3_docs/keywords.htm##include) <GUIConstantsEx.au3>
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) $hGui, $iIcoClick, $iIcoHover, $iHover, $aInfo
$hGui = GUICreate (http://autoit-script.ru/autoit3_docs/functions/GUICreate.htm)('Test', 160, 112)
GUICtrlCreateLabel (http://autoit-script.ru/autoit3_docs/functions/GUICtrlCreateLabel.htm)('Click', 32, 20, 32, 17)
GUICtrlCreateLabel (http://autoit-script.ru/autoit3_docs/functions/GUICtrlCreateLabel.htm)('Hover', 96, 20, 32, 17)
$iIcoClick = GUICtrlCreateIcon (http://autoit-script.ru/autoit3_docs/functions/GUICtrlCreateIcon.htm)('shell32.dll', __Random(), 32, 40, 32, 32)
GUICtrlSetCursor (http://autoit-script.ru/autoit3_docs/functions/GUICtrlSetCursor.htm)(-1, 0)
$iIcoHover = GUICtrlCreateIcon (http://autoit-script.ru/autoit3_docs/functions/GUICtrlCreateIcon.htm)('shell32.dll', __Random(), 96, 40, 32, 32)
GUICtrlSetCursor (http://autoit-script.ru/autoit3_docs/functions/GUICtrlSetCursor.htm)(-1, 0)
GUISetState (http://autoit-script.ru/autoit3_docs/functions/GUISetState.htm)()
While (http://www.autoitscript.com/autoit3/docs/keywords.htm#While) 1
Switch (http://www.autoitscript.com/autoit3/docs/keywords.htm#Switch) GUIGetMsg (http://autoit-script.ru/autoit3_docs/functions/GUIGetMsg.htm)()
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) $GUI_EVENT_CLOSE
Exit (http://www.autoitscript.com/autoit3/docs/keywords.htm#Exit)
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) $iIcoClick
GUICtrlSetImage (http://autoit-script.ru/autoit3_docs/functions/GUICtrlSetImage.htm)($iIcoClick, 'shell32.dll', __Random())
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) $GUI_EVENT_MOUSEMOVE
$aInfo = GUIGetCursorInfo (http://autoit-script.ru/autoit3_docs/functions/GUIGetCursorInfo.htm)()
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) @error (http://autoit-script.ru/autoit3_docs/macros.htm#@error) Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then) ContinueLoop (http://www.autoitscript.com/autoit3/docs/keywords.htm#ContinueLoop)
Switch (http://www.autoitscript.com/autoit3/docs/keywords.htm#Switch) $aInfo[4]
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) $iIcoHover
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) Not (http://www.autoitscript.com/autoit3/docs/keywords.htm#Not) $iHover Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
GUICtrlSetImage (http://autoit-script.ru/autoit3_docs/functions/GUICtrlSetImage.htm)($iIcoHover, 'shell32.dll', __Random())
$iHover = 1
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) Else (http://www.autoitscript.com/autoit3/docs/keywords.htm#Else)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $iHover Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then) $iHover = 0
EndSwitch (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndSwitch)
EndSwitch (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndSwitch)
WEnd (http://www.autoitscript.com/autoit3/docs/keywords.htm#WEnd)
Func (http://www.autoitscript.com/autoit3/docs/keywords.htm#Func) __Random()
Local (http://www.autoitscript.com/autoit3/docs/keywords.htm#Local) Static (http://www.autoitscript.com/autoit3/docs/keywords.htm#Static) $i__OldRand = -1
Local (http://www.autoitscript.com/autoit3/docs/keywords.htm#Local) $i_Min = 5, $i_Max = 25, $i_Rand = $i__OldRand
While (http://www.autoitscript.com/autoit3/docs/keywords.htm#While) $i_Rand = $i__OldRand
$i_Rand = Random (http://autoit-script.ru/autoit3_docs/functions/Random.htm)($i_Min, $i_Max, 1)
WEnd (http://www.autoitscript.com/autoit3/docs/keywords.htm#WEnd)
$i__OldRand = $i_Rand
Return (http://www.autoitscript.com/autoit3/docs/keywords.htm#Return) $i_Rand
EndFunc (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndFunc) ;==>__Random
vBulletin v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.