Terenz Posted May 20, 2015 Share Posted May 20, 2015 (edited) Hi guys,I don't have never used all the pixel function so the error maybe is simple. I want to know the color of a control inside the GUI:#include <StaticConstants.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("My Name", 293, 154, -1, -1) $Label = GUICtrlCreateLabel("", 100, 56, 28, 28) GUICtrlSetBkColor(-1, 0x0054E3) GUISetState(@SW_SHOW) $aPos = ControlGetPos($hGUI, "", $Label) ConsoleWrite("Position: " & $aPos[0] & "," & $aPos[1] & @CRLF & "Size: " & $aPos[2] & "," & $aPos[3] & @CR) $Col = PixelGetColor($aPos[0], $aPos[1], $Form1) ConsoleWrite("Color: 0x" & Hex($Col, 6) & @CR) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEndThe output is:Position: 100,56 Size: 28,28 Color: 0xECE9D8As you can see, the color don't match 0xECE9D8 vs 0x0054E3Why? Edited May 20, 2015 by Terenz Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
UEZ Posted May 20, 2015 Share Posted May 20, 2015 Probably the coordinates are different than expected. Try to set AutoItSetOption("GUICoordMode", 0) and try again. Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Terenz Posted May 20, 2015 Author Share Posted May 20, 2015 (edited) Done, the result is:Position: 99,55 Size: 28,28 Color: 0xECE9D8Always different. ThanksEDIT: Solved with "PixelCoordMode" with 2, thanks UEZ for point me in the right direction Edited May 20, 2015 by Terenz Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
UEZ Posted May 29, 2015 Share Posted May 29, 2015 (edited) You can use also _WinAPI_GetSysColor() to get the default color of any specified display element. Edited May 29, 2015 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
jguinch Posted May 29, 2015 Share Posted May 29, 2015 You can also retrieve the position relative to screen of the control by using WinGetPos and the control handle as parameter :$hCtrl = GUICtrlGetHandle($Label) $aPos = WinGetPos( $hCtrl) ConsoleWrite("Position: " & $aPos[0] & "," & $aPos[1] & @CRLF & "Size: " & $aPos[2] & "," & $aPos[3] & @CR) $Col = PixelGetColor($aPos[0], $aPos[1], $hGUI) ConsoleWrite("Color: 0x" & Hex($Col, 6) & @CR) Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now