akroon Posted January 11, 2014 Posted January 11, 2014 Hy all how i can show a color with a GUI? I don't want color any label, i want a GUI like a square where i can set the color. Thanx
Moderators Melba23 Posted January 11, 2014 Moderators Posted January 11, 2014 akroon,GUISetBkColor - the Help file tells you the rest. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
akroon Posted January 11, 2014 Author Posted January 11, 2014 But this function color all the gui . I want a gui like a checkbox where i can show just the color.
Moderators Melba23 Posted January 11, 2014 Moderators Posted January 11, 2014 akroon,Do mean a colour selection tool? If so the _ChooseColor is what you are looking for. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
akroon Posted January 13, 2014 Author Posted January 13, 2014 Sorry, maybe i don't explain so good what i need. I want show what pixel color i get with function pixelgetcolor. I can set color of a label or other gui, i'm just looking for a this gui where i use just for show color. Sorry for my english. Thanx.
l3ill Posted January 13, 2014 Posted January 13, 2014 (edited) Hi akroon, I think you mean you want a rectangle (or similar) in your GUI that shows what color you have dynamically with PixelGetColor? If yes, I have never done this but you can look at GUICtrlSetGraphic. See below Bill Edited January 13, 2014 by l3ill My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
Solution l3ill Posted January 13, 2014 Solution Posted January 13, 2014 (edited) Okay Now I have: I found this very cool Mouse Finder Tool I while back (wish I knew who it came from) And added the above mentioned functionality: (uses GUICtrlCreateGraphic and PixelGetColor) To update the GUI with the actual color while writing the Hex to the console. #include <Misc.au3> #include <GuiConstants.au3> Global $iColor $GUICoord = GUICreate('Mouse Finder Tool', '150', '40', '-1', '-1', '-1', '128') Global $CoordInput = GUICtrlCreateInput('', '0', '0', '150', '20', '1') GUICtrlSetFont($CoordInput, '9', '600', '', 'Arial') $rectColor = GUICtrlCreateGraphic(-1, 20, 150, 20) GUISetState(@SW_SHOW, $GUICoord) WinSetOnTop($GUICoord, '', '1') AdlibRegister("RefreshCoord", 50) Local $hDLL = DllOpen("user32.dll") While 1 If _IsPressed("01", $hDLL) Then $Pos = MouseGetPos() ConsoleWrite("Mouse Coords are : X: " & $Pos['0'] & " Y: " & $Pos['1'] & @CRLF) GUICtrlSetBkColor($rectColor, $iColor) ConsoleWrite("Picked Color is : " & Hex ($iColor) & @CRLF) While _IsPressed("01") Sleep(1) WEnd EndIf If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop WEnd DllClose($hDLL) AdlibUnRegister("RefreshCoord") GUIDelete($GUICoord) Func RefreshCoord() $Pos = MouseGetPos() GUICtrlSetData($CoordInput, "X: " & $Pos['0'] & " Y: " & $Pos['1']) $iColor = PixelGetColor($Pos['0'],$Pos['1']) EndFunc Edited January 13, 2014 by l3ill My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
Zedna Posted January 15, 2014 Posted January 15, 2014 Look at examples in AutoIt's helpfile for these functions: GUICtrlCreateGraphic() GUICtrlSetGraphic() - $GUI_GR_RECT Resources UDF ResourcesEx UDF AutoIt Forum Search
akroon Posted January 17, 2014 Author Posted January 17, 2014 (edited) Okay Now I have: I found this very cool Mouse Finder Tool I while back (wish I knew who it came from) And added the above mentioned functionality: (uses GUICtrlCreateGraphic and PixelGetColor) To update the GUI with the actual color while writing the Hex to the console. #include <Misc.au3> #include <GuiConstants.au3> Global $iColor $GUICoord = GUICreate('Mouse Finder Tool', '150', '40', '-1', '-1', '-1', '128') Global $CoordInput = GUICtrlCreateInput('', '0', '0', '150', '20', '1') GUICtrlSetFont($CoordInput, '9', '600', '', 'Arial') $rectColor = GUICtrlCreateGraphic(-1, 20, 150, 20) GUISetState(@SW_SHOW, $GUICoord) WinSetOnTop($GUICoord, '', '1') AdlibRegister("RefreshCoord", 50) Local $hDLL = DllOpen("user32.dll") While 1 If _IsPressed("01", $hDLL) Then $Pos = MouseGetPos() ConsoleWrite("Mouse Coords are : X: " & $Pos['0'] & " Y: " & $Pos['1'] & @CRLF) GUICtrlSetBkColor($rectColor, $iColor) ConsoleWrite("Picked Color is : " & Hex ($iColor) & @CRLF) While _IsPressed("01") Sleep(1) WEnd EndIf If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop WEnd DllClose($hDLL) AdlibUnRegister("RefreshCoord") GUIDelete($GUICoord) Func RefreshCoord() $Pos = MouseGetPos() GUICtrlSetData($CoordInput, "X: " & $Pos['0'] & " Y: " & $Pos['1']) $iColor = PixelGetColor($Pos['0'],$Pos['1']) EndFunc Yea! That's realy what i need. Thank you so much Edited January 17, 2014 by akroon
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