Sign in to follow this  
Followers 0
James

Set a Label BkColor to the themes default colour

9 posts in this topic

#1 ·  Posted (edited)

Hey all,

If I was to have a label as a block. How could I automatically change the colour of it to the themes default colour?

I tried,

DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)oÝ÷ Ø­.qǬ±8ZK  jg¬lGb´kç]¢)àjëh×6GUICtrlSetBkColor($colorblox, DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0))

But it came out black from the Royale Blue theme.

Edited by JamesB

Share this post


Link to post
Share on other sites

if the GUI uses the themes default color, just set the label as transparent

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Good idea, I will try that now.

Edit: I mean that if the user is using Windows XP Default Blue theme, it will use the default blue color. and if they use the Silver it will be a silver block.

Edited by JamesB

Share this post


Link to post
Share on other sites

I tried,

GUICtrlSetBkColor($colorblox, DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0))oÝ÷ Ø­×ê.µ¹ZrGë¢kay2jWç­éßÛßêº^N­ßÛºyòß}÷ßrÞ¶g²L¨¹ª®zËb¢|!j×hzÆ®¶­sd×6t&÷cBÂgV÷C´GVgV÷C²ÂgV÷C³gV÷C²fײWFÆÄ6ÆÂgV÷C·WFVÖRæFÆÂgV÷C²ÂgV÷C¶æöæRgV÷C²ÂgV÷Cµ6WEFVÖT&÷W'FW2gV÷C²ÂgV÷C¶çBgV÷C²ÂÂb
Give you? Once you answer that, what does that color translate too?

(Although!! It did change the msgbox's default theme... which I thought was cool).


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I don't get the question at all.

The label is already using default color of current theme, unless you specify another color with GuiCtrlSetBkColor.

Edited by Siao

"be smart, drink your wine"

Share this post


Link to post
Share on other sites

Take a look at this, MCL. When you run it, you will notice there is a box which you can move the window around with. If you are using Windows XP default it will be blue otherwise it will change colour depending on what the default theme colour is.

Share this post


Link to post
Share on other sites

That's active/inactive titlebar color.

#include <GuiConstants.au3>

;~ Global Const $WM_ACTIVATE = 0x6
Global Const $COLOR_ACTIVECAPTION = 2
Global Const $COLOR_INACTIVECAPTION = 3

$hGui = GUICreate("Color...", 200, 200, -1, -1, -1, $WS_EX_TOPMOST)
GUIRegisterMsg($WM_ACTIVATE, "On_WM_ACTIVATE")
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func On_WM_ACTIVATE($hWnd, $Msg, $wParam, $lParam)
    Local $iColorIndex, $aRet
    If $wParam Then
        $iColorIndex = $COLOR_ACTIVECAPTION
    Else
        $iColorIndex = $COLOR_INACTIVECAPTION
    EndIf
    $aRet = DllCall('user32.dll', 'int', 'GetSysColor', 'int', $iColorIndex)
    GUISetBkColor(RGB2BGR($aRet[0]))
    Return $GUI_RUNDEFMSG
EndFunc
Func RGB2BGR($iColor)
    Return BitAND(BitShift(String(Binary($iColor)), 8), 0xFFFFFF)
EndFunc

"be smart, drink your wine"

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

So it is. Is there anyway in which to get that colour in a box?.. I think it's in that code there ^-^ - Haha, I forgot to uncomment the $WM_ACTIVATE bit :P Thanks Siao Edited by JamesB

Share this post


Link to post
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
Sign in to follow this  
Followers 0