找回密码
 加入
搜索
查看: 2909|回复: 5

[GUI管理] 为什么用PixelGetColor获取的颜色值与我设置的不一样?[已解决]

  [复制链接]
发表于 2015-3-4 16:53:01 | 显示全部楼层 |阅读模式
本帖最后由 penguinl 于 2015-3-4 18:03 编辑

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPIGdi.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 117, 78, 192, 124)
$Label1 = GUICtrlCreateLabel("", 0, 0, 16, 16, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, 5, 400, 0, "MS Sans Serif")
;~ GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetBkColor(-1, 0x000000)
GUISetState(@SW_SHOW)
$PointColor = "0x000000"
For $Y = 0 To 16
        For $X = 0 To 16
                ToolTip($X & " - " & $Y & @CRLF & $PointColor & " @ " & Hex(_WinAPI_SwitchColor(PixelGetColor($X, $Y, $Form1))))
                Sleep(10)
        Next
Next
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd
发表于 2015-3-4 17:31:49 | 显示全部楼层
PixelGetColor 获取的是绝对坐标,并非窗口的相对坐标
 楼主| 发表于 2015-3-4 17:34:59 | 显示全部楼层
啊!是这样?那函数第三个参数的作用是什么?
发表于 2015-3-4 17:58:16 | 显示全部楼层
回复 3# penguinl


    那个参数似乎没用,以前测试过
 楼主| 发表于 2015-3-4 18:03:10 | 显示全部楼层
好吧,测试了下,确实是绝对坐标,谢谢afan了!
发表于 2016-11-2 13:00:42 | 显示全部楼层
afan  正解
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-18 18:15 , Processed in 0.077983 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表