#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$j = Random(0, 9, 1)
Dim $aPic[10] = [@ScriptDir & '\1.jpg', @ScriptDir & '\2.jpg', _
@ScriptDir & '\3.jpg', @ScriptDir & '\4.jpg', @ScriptDir & '\5.jpg', _
@ScriptDir & '\6.jpg', @ScriptDir & '\7.jpg', @ScriptDir & '\8.jpg', _
@ScriptDir & '\9.jpg', @ScriptDir & '\0.jpg']
$hGui = GUICreate('', 150, 100, -1, -1, $WS_POPUP)
GUISetBkColor(0x000000)
_GuiRoundCorners($hGui, 0, 0, 20, 20)
GUIRegisterMsg($WM_NCHITTEST, 'WM_NCHITTEST')
$Pic = GUICtrlCreatePic($aPic[$j], 40, 29, 24, 28)
GUICtrlSetCursor(-1, 0)
$LabelExit = GUICtrlCreateLabel('X', 134, 3, 16, 16)
GUICtrlSetState(-1, $GUI_FOCUS)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetCursor(-1, 0)
$ButtonUP = GUICtrlCreateButton('с', 94, 20, 22, 22, -1, $WS_EX_STATICEDGE)
$ButtonDown = GUICtrlCreateButton('т', 94, 45, 22, 22, -1, $WS_EX_STATICEDGE)
$ButtonGo = GUICtrlCreateButton('ф', 40, 65, 24, 24, -1, $WS_EX_STATICEDGE)
For $i = $ButtonUP To $ButtonGo
GUICtrlSetCursor($i, 0)
GUICtrlSetFont($i, 11, 600, 0, 'Wingdings')
GUICtrlSetColor($i, 0xFFFFFF)
GUICtrlSetBkColor($i, 0x000000)
Next
DllCall('User32.dll', 'long', 'AnimateWindow', 'hwnd', $hGui, 'long', 800, 'long', 0x10)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $LabelExit
DllCall('User32.dll', 'long', 'AnimateWindow', 'hwnd', $hGui, 'long', 800, 'long', 0x10 + 0x10000)
Exit
Case $ButtonUP
_ButtonState(0)
$j += 1
If $j = 10 Then
$j = 0
EndIf
GUICtrlSetImage($Pic, $aPic[$j])
_ButtonState(1)
Case $ButtonDown
_ButtonState(0)
$j -= 1
If $j = -1 Then
$j = 9
EndIf
GUICtrlSetImage($Pic, $aPic[$j])
_ButtonState(1)
Case $ButtonGo
_ButtonState(0)
For $i = 0 To 9
GUICtrlSetImage($Pic, $aPic[$i])
Sleep(300)
Next
$j = 9
_ButtonState(1)
Case $Pic
MsgBox(64, 'Test', 'Картинка работает как кнопка.')
EndSwitch
WEnd
Func _ButtonState($n)
Local $iState
If $n Then
$iState = $GUI_ENABLE
Else
$iState = $GUI_DISABLE
EndIf
For $i = $Pic To $ButtonGo
GUICtrlSetState($i, $iState)
Next
EndFunc ;==>_ButtonState
Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3)
Dim $pos, $ret, $ret2
$pos = WinGetPos($h_win)
$ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3)
If $ret[0] Then
$ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1)
If $ret2[0] Then
Return 1
Else
Return 0
EndIf
Else
Return 0
EndIf
EndFunc ;==>_GuiRoundCorners
Func WM_NCHITTEST($hWnd, $msg, $wParam, $lParam)
Local $iProc = DllCall('user32.dll', 'int', 'DefWindowProc', 'hwnd', $hWnd, 'int', _
$msg, 'wparam', $wParam, 'lparam', $lParam)
If $iProc[0] = $HTCLIENT Then Return $HTCAPTION
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NCHITTEST