คลิ๊กปุ่มแล้วรูปเปลี่ยน ลองคลิ๊กดู
- Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("โปรแกรมสุ่มรูป", 361, 232, 559, 193)
$Button1 = GUICtrlCreateButton("Button1", 16, 8, 89, 81, $BS_ICON)
$Button2 = GUICtrlCreateButton("Button2", 128, 8, 89, 81, $BS_ICON)
$Button3 = GUICtrlCreateButton("Button3", 240, 8, 89, 81, $BS_ICON)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$Change = Random(139,300,1)
for $i = $Change to $Change+30
GUICtrlSetImage($Button1, @SystemDir & "\shell32.dll",$i)
Sleep(100)
Next
Case $Button2
$Change = Random(139,300,1)
for $i = $Change to $Change+30
GUICtrlSetImage($Button2, @SystemDir & "\shell32.dll", $i )
Sleep(100)
Next
Case $Button3
$Change = Random(139,300,1)
for $i = $Change to $Change+30
GUICtrlSetImage($Button3, @SystemDir & "\shell32.dll", $i )
Sleep(100)
Next
EndSwitch
WEnd