本帖最后由 骗子 于 2011-5-24 10:17 编辑
Global $Paused
HotKeySet("{enter}", "TogglePause") ;把回车定义成快捷键
GUICreate("取十進位",152,200,10,10)
GUICtrlCreateLabel("X座標",5,5,42,20,0x00800000,0x01)
$A1 = GUICtrlCreateInput("",5,25,60,22,0x00800000,0x00000200)
GUICtrlSetFont(-1, 12)
GUICtrlCreateLabel(",",70,35,12,12,0x01)
GUICtrlCreateLabel("Y座標",85,5,42,20,0x00800000,0x01)
$A2 = GUICtrlCreateInput("",85,25,60,22,0x00800000,0x00000200)
GUICtrlSetFont(-1, 12)
GUICtrlCreateLabel("十進位Dec:",5,60,68,20,0x00800000,0x01)
$A3 = GUICtrlCreateInput("0",5,80,100,22,0x00800000,0x00000200)
GUICtrlSetFont(-1, 12)
GUICtrlCreateLabel("Hex",5,110,28,20,0x00800000,0x01)
$A4 = GUICtrlCreateInput("0",5,130,100,22,0x00800000,0x00000200)
GUICtrlSetFont(-1, 12)
$1Button = GUICtrlCreateButton("取顏色碼" , 5,156,82,30,0x00800000,0x01)
GUISetState()
While 1
$pos = MouseGetPos() ;读取当前鼠标坐标
GUICtrlSetData($A1,$pos[0] ) ;设置输入框A1的数据为坐标的X
GUICtrlSetData($A2,$pos[1] ) ;;设置输入框A1的数据为坐标的Y
$msg = GUIGetMsg()
Switch $msg
Case -3
Exit
Case $1Button
$var1 = GUICtrlRead($A1)
$var2 = GUICtrlRead($A2)
$Pix = PixelGetColor($var1,$var2)
GUICtrlSetData($A3,$Pix)
GUICtrlSetData($A4,Hex($Pix,6))
EndSwitch
WEnd
Func TogglePause()
$Paused = NOT $Paused
While $Paused
sleep(100)
ToolTip('选定的坐标为'&$pos[0]&','&$pos[1]) ;注意提示框的位置
WEnd
ToolTip("")
EndFunc
|