Sign in to follow this  
Followers 0
Grosminet

How the current theme influence the GUI design

3 posts in this topic

Hi,

Just one small remark about the help file example "_WinAPI_GetThemeAppProperties.au3" : I think that to appreciate the theme influence on the GUI design, we can mix the Theme's flags during the GUI creation . According this MSN link : SetThemeAppProperties , one "sendMessage:WM_THEMECHANGED" is mandatory to activate any change !

This allow to discover:

  • that the GUICtrlSetColor works well without Theme activation (all flags set to 0), but not with an Aero Theme (this is probably normal, but strange for me, because the color should be applied to the text (like the font size and its name), and not to the control design ?!? ...) -> please, have a look to the first "Group" (color blu OK) and to the second "Group" (color red notok).
  • that we can mix different control design in the same GUI.

Here is the help example file modified . ;)

Thanks, Alain.

#include <APIThemeConstants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPITheme.au3>
#include <SendMessage.au3>
#include <WindowsConstants.au3>

Local $iTheme = _WinAPI_GetThemeAppProperties()

Local $hForm = GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'), 310, 360)

    _WinAPI_SetThemeAppProperties(0)
    _SendMessage($hForm, $WM_THEMECHANGED)

    GUISetFont(8.5, 400, 0, 'MS Shell Dlg', $hForm)
    GUICtrlCreateGroup('Group', 10, 10, 140, 95)
    GUICtrlSetColor(-1,0x0000FF) ; Please check the color !
    GUICtrlCreateCheckbox('Check1', 22, 26, 120, 23)
    GUICtrlCreateCheckbox('Check2', 22, 49, 120, 23)
    
    _WinAPI_SetThemeAppProperties(BitOr($STAP_ALLOW_NONCLIENT, $STAP_ALLOW_CONTROLS))
    _SendMessage($hForm, $WM_THEMECHANGED)

    GUICtrlCreateCheckbox('Check3', 22, 72, 120, 23)
    

    GUICtrlCreateGroup('Group', 160, 10, 140, 95)
    GUICtrlSetColor(-1,0xFF0000) ; Please check this color !
    GUICtrlCreateRadio('Radio1', 172, 26, 120, 23)
    GUICtrlCreateRadio('Radio2', 172, 49, 120, 23)
    
    _WinAPI_SetThemeAppProperties(0)
    _SendMessage($hForm, $WM_THEMECHANGED)

    GUICtrlCreateRadio('Radio3', 172, 72, 120, 23)
    GUICtrlCreateButton('OK 1', 70, 330, 70, 23)
    
    _WinAPI_SetThemeAppProperties(BitOr($STAP_ALLOW_NONCLIENT, $STAP_ALLOW_CONTROLS))
    _SendMessage($hForm, $WM_THEMECHANGED)

    GUICtrlCreateButton('OK 2', 180, 330, 70, 23)
    GUICtrlCreateTab(10, 118, 292, 206)
    GUICtrlCreateTabItem('Tab1')
    
    _WinAPI_SetThemeAppProperties(0)
    _SendMessage($hForm, $WM_THEMECHANGED)

    GUICtrlCreateTabItem('Tab2')
    GUICtrlCreateTabItem('')
    
    _WinAPI_SetThemeAppProperties($iTheme)
    _SendMessage($hForm, $WM_THEMECHANGED)

GUISetState(@SW_SHOW)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Tests done with:

  • Autoit 3.3.14.2
  • Windows 7 Home Premium Service Pack 1
  • Computer ASUS N56V
  • Screen resolution: 1920x1080 (recommended)
  • Theme :Windows Classic, AeroTheme Windows 7.

Share this post


Link to post
Share on other sites



or try this...

 

DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)

 


C0d3 is P0etry( ͡° ͜ʖ ͡°)

Share this post


Link to post
Share on other sites

@Kovacic, equivalent to the library "WinAPITheme.au3" with flags=0

; #FUNCTION# ====================================================================================================================
; Author.........: Yashied
; Modified.......: jpm
; ===============================================================================================================================
Func _WinAPI_SetThemeAppProperties($iFlags)
    DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'dword', $iFlags)
    If @error Then Return SetError(@error, @extended, 0)

    Return 1
EndFunc   ;==>_WinAPI_SetThemeAppProperties

A.

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