Jump to content

Change color slider control on win 10 [SOLVED]


nend
 Share

Recommended Posts

Hello,

Is it possible to change the color of a slider control?

In my windows (wndows 10) it's blue (see the screenshot) and that's the thing I want to be a different color.

I'v try'd it with serveral options such as:

- GUICtrlSetColor

- GUICtrlSetBkColor

 

But no changes in color.

Does anyone has any idea?

 

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()

    GUICreate("slider", 220, 100, 100, 200)

    Local $idSlider1 = GUICtrlCreateSlider(10, 10, 200, 40)
    GUICtrlSetColor (-1, 0x808080)
    GUICtrlSetLimit(-1, 200, 0) ; change min/max value
    Local $idButton = GUICtrlCreateButton("Value?", 75, 70, 70, 20)
    GUISetState(@SW_SHOW)
    GUICtrlSetData($idSlider1, 45) ; set cursor

    Local $idMsg
    ; Loop until the user exits.
    Do
        $idMsg = GUIGetMsg()

        If $idMsg = $idButton Then
            MsgBox($MB_SYSTEMMODAL, "slider1", GUICtrlRead($idSlider1), 2)
        EndIf
    Until $idMsg = $GUI_EVENT_CLOSE
EndFunc   ;==>Example

 

Knipsel.PNG

Edited by nend
Link to comment
Share on other sites

No clue, but I did come across this as a potential alternative.  Might be worth checking out as an interim if customizing the slider appearance is essential.  
Of course someone else may chime in with a method to actually color the standard control.....
 

Link to comment
Share on other sites

No clue, but I did come across this as a potential alternative.  Might be worth checking out as an interim if customizing the slider appearance is essential.  
Of course someone else may chime in with a method to actually color the standard control.....
 

Thanks for the tip, I'll wil look into it.

Link to comment
Share on other sites

You might try this, it works in Win7 not sure about 10?

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Global Const $WM_CTLCOLORSTATIC = 0x0138

Example()

Func Example()
    global $iBursh = DllCall("gdi32.dll","hwnd","CreateSolidBrush","dword",0x808080)
    GUICreate("slider", 220, 100, 100, 200)

    Local $idSlider1 = GUICtrlCreateSlider(10, 10, 200, 40)
    ;GUICtrlSetColor (-1, 0x808080)
    GUICtrlSetLimit(-1, 200, 0) ; change min/max value
    Local $idButton = GUICtrlCreateButton("Value?", 75, 70, 70, 20)
    GUICtrlSetData($idSlider1, 45) ; set cursor
    GUIRegisterMsg($WM_CTLCOLORSTATIC,"WM_CTLCOLORSTATIC")
    GUISetState(@SW_SHOW)

    Local $idMsg
    ; Loop until the user exits.
    Do
        $idMsg = GUIGetMsg()

        If $idMsg = $idButton Then
            MsgBox($MB_SYSTEMMODAL, "slider1", GUICtrlRead($idSlider1), 2)
        EndIf
    Until $idMsg = $GUI_EVENT_CLOSE
EndFunc   ;==>Example

Func WM_CTLCOLORSTATIC($hWin,$uMsg,$wParam,$lParam)
        return $iBursh[0]
EndFunc

 

Link to comment
Share on other sites

On 16-1-2016 at 4:49 PM, xroot said:

You might try this, it works in Win7 not sure about 10?

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Global Const $WM_CTLCOLORSTATIC = 0x0138

Example()

Func Example()
    global $iBursh = DllCall("gdi32.dll","hwnd","CreateSolidBrush","dword",0x808080)
    GUICreate("slider", 220, 100, 100, 200)

    Local $idSlider1 = GUICtrlCreateSlider(10, 10, 200, 40)
    ;GUICtrlSetColor (-1, 0x808080)
    GUICtrlSetLimit(-1, 200, 0) ; change min/max value
    Local $idButton = GUICtrlCreateButton("Value?", 75, 70, 70, 20)
    GUICtrlSetData($idSlider1, 45) ; set cursor
    GUIRegisterMsg($WM_CTLCOLORSTATIC,"WM_CTLCOLORSTATIC")
    GUISetState(@SW_SHOW)

    Local $idMsg
    ; Loop until the user exits.
    Do
        $idMsg = GUIGetMsg()

        If $idMsg = $idButton Then
            MsgBox($MB_SYSTEMMODAL, "slider1", GUICtrlRead($idSlider1), 2)
        EndIf
    Until $idMsg = $GUI_EVENT_CLOSE
EndFunc   ;==>Example

Func WM_CTLCOLORSTATIC($hWin,$uMsg,$wParam,$lParam)
        return $iBursh[0]
EndFunc

 

I've tryd this but only the background get painted on windows 10.

I don't think this is possible.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...