Invicore Posted March 23, 2021 Share Posted March 23, 2021 Hi I want to change background and foreground color of Progress bar that I created with GUICtrlCreateProgress I found this piece of code in this forum, this code only change progressBar foreground color to blue $Progress1 = GUICtrlCreateProgress(25, 150, 350, 26) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($Progress1), "wstr", 0, "wstr", 0) GUICtrlSetStyle($Progress1, BitOr($GUI_SS_DEFAULT_PROGRESS, $PBS_SMOOTH)) its possible to for example change background color to black and foreground to red thanks Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 23, 2021 Moderators Share Posted March 23, 2021 Invicore, You can change the colour of the bar itself like this: #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <SendMessage.au3> $hGUI = GUICreate("Test", 300, 380) GUIStartGroup() $cRadio_1 = GUICtrlCreateRadio("Green", 60, 95, 60, 20) GUICtrlSetState(-1, $GUI_CHECKED) $cRadio_2 = GUICtrlCreateRadio("Red", 120, 95, 60, 20) $cRadio_3 = GUICtrlCreateRadio("Yellow", 180, 95, 60, 20) $cProgress = GUICtrlCreateProgress(25, 130, 250, 15) GUICtrlSetData(-1, 50) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cRadio_1 _SendMessage(GUICtrlGetHandle($cProgress), $PBM_SETSTATE, 1) Case $cRadio_2 _SendMessage(GUICtrlGetHandle($cProgress), $PBM_SETSTATE, 2) Case $cRadio_3 _SendMessage(GUICtrlGetHandle($cProgress), $PBM_SETSTATE, 3) EndSwitch WEnd No idea about how to change the background. M23 Invicore 1 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 Link to comment Share on other sites More sharing options...
Invicore Posted March 23, 2021 Author Share Posted March 23, 2021 (edited) 16 minutes ago, Melba23 said: Invicore, You can change the colour of the bar itself like this: #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <SendMessage.au3> $hGUI = GUICreate("Test", 300, 380) GUIStartGroup() $cRadio_1 = GUICtrlCreateRadio("Green", 60, 95, 60, 20) GUICtrlSetState(-1, $GUI_CHECKED) $cRadio_2 = GUICtrlCreateRadio("Red", 120, 95, 60, 20) $cRadio_3 = GUICtrlCreateRadio("Yellow", 180, 95, 60, 20) $cProgress = GUICtrlCreateProgress(25, 130, 250, 15) GUICtrlSetData(-1, 50) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cRadio_1 _SendMessage(GUICtrlGetHandle($cProgress), $PBM_SETSTATE, 1) Case $cRadio_2 _SendMessage(GUICtrlGetHandle($cProgress), $PBM_SETSTATE, 2) Case $cRadio_3 _SendMessage(GUICtrlGetHandle($cProgress), $PBM_SETSTATE, 3) EndSwitch WEnd No idea about how to change the background. M23 thank you, I search a little more and found this code In this post DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", 0, "wstr", 0) GUICtrlSetStyle($Progress1, BitOr($GUI_SS_DEFAULT_PROGRESS, $PBS_SMOOTH)) GUICtrlSetColor(-1, 0xff0000) ; Red GUICtrlSetBkColor(-1, 0x000000) ; Black with it, its possible to change color of both background and bar itself Edited March 23, 2021 by Invicore Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 23, 2021 Moderators Share Posted March 23, 2021 Invicore, Great. But when you reply in future, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - I know what I wrote and it just pads the thread unnecessarily. Thanks in advance for your cooperation. M23 Invicore 1 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 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