Jump to content

Gui theme change question


youtuber
 Share

Recommended Posts

Hi friends

I would like to change the theme with the help of a button

 

#include "MetroGUI-UDF\MetroGUI_UDF.au3"
#include <Array.au3>
Global $aAraayList[18] = ["LightTeal", "DarkTeal", "DarkMidnight", "DarkBlue", "DarkBlueV2", "LightCyan", "DarkCyan", "LightGray", "LightGreen", "DarkGreen", "LightRed", "DarkGray", "DarkAmber", "LightOrange", "DarkOrange", "LightPurple", "DarkPurple", "LightPink"]
Global $List = 0

_SetTheme(_ThemeChange())
$Form1 = _Metro_CreateGUI("Form1", 428, 258, -1, -1, True)
$Control_Buttons = _Metro_AddControlButtons(True, True, True, True, True)
$GUI_CLOSE_BUTTON = $Control_Buttons[0]
$GUI_MAXIMIZE_BUTTON = $Control_Buttons[1]
$GUI_RESTORE_BUTTON = $Control_Buttons[2]
$GUI_MINIMIZE_BUTTON = $Control_Buttons[3]
$GUI_FULLSCREEN_BUTTON = $Control_Buttons[4]
$GUI_FSRestore_BUTTON = $Control_Buttons[5]
$GUI_MENU_BUTTON = $Control_Buttons[6]

$ButtonSetTheme = _Metro_CreateButton("ButtonSet", 80, 160, 75, 25)
$ButtonChangeTheme = _Metro_CreateButton("ButtonChange", 240, 160, 75, 25)

GUISetState(@SW_SHOW)
While 1
     _Metro_HoverCheck_Loop($Form1)
    Sleep(10)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON
            _Metro_GUIDelete($Form1)
            Exit
        Case $GUI_MAXIMIZE_BUTTON
            GUISetState(@SW_MAXIMIZE)
        Case $GUI_RESTORE_BUTTON
            GUISetState(@SW_RESTORE)
        Case $GUI_MINIMIZE_BUTTON
            GUISetState(@SW_MINIMIZE)
        Case $GUI_FULLSCREEN_BUTTON, $GUI_FSRestore_BUTTON
            _Metro_FullscreenToggle($Form1, $Control_Buttons)


Case $ButtonSetTheme
$VarTema = RegRead('HKCU\Software\MetroGui\Tema', 'Set')
_ThemeChange($VarTema)

        Case $ButtonChangeTheme
RegWrite('HKCU\Software\MetroGui\Tema', 'Set','REG_SZ', _ThemeChange())

   EndSwitch
WEnd

Func _ThemeChange($aAraayList[$List])

  If $List >= UBound($aAraayList) Then $List = 0

$List += 1
Return $aAraayList[$List]
EndFunc

Theme:

 

Link to comment
Share on other sites

  • Moderators

Good for you, hope it goes well

If this post seems lacking in assistance, it is because yours is lacking a description of what trouble you're having, unless you're simply asking for someone to do it for you ;)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

I am saying you point out what you want, not where you are running into problems. Explain in detail where you are having difficulty.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • 1 month later...
On 9/22/2017 at 2:45 PM, youtuber said:

ok.

How can I change the theme instantly with the button?

yes.
in "MetroGUI UDF v5.1 - Windows 10 style buttons, toggles, radios, menu etc." there is an example that does change the theme.
Just create a button and assign a function to change it ( I will not show an example ).
If you solved it, share your solution ( code example ), as it serves everyone watching this posting.  

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

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...