Sign in to follow this  
Followers 0
JohnOne

Transparent group background

2 posts in this topic

I have looked about, but can only find threads about wanting transparency. Im sure it has been covered but I cannot find anything.

I do not, yet a group in my code is transparent anyway :D

Here is a reproducer of my problem

#include <WindowsConstants.au3>

Global $aOld_Theme
Global $sTitle = "Problem GUI"

HotKeySet("{ESC}", "_Exit")

_Window()

Func _Window()
    KillThemes(True)

    Local $ojt, $AX, $msg, $problemgroup, $label

    $ojt = ObjCreate("Shell.Explorer.2")
    GUICreate($sTitle, 1024, 768, 0, 0, BitOR($WS_POPUP, $WS_BORDER, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
    GUISetBkColor(0x000000, $sTitle)
    GUICtrlSetDefColor(0xFFFFFF); <<=========================================== Thanks for the tip Melba
    $AX = GUICtrlCreateObj($ojt, 122, 96, 781, 576)
    $problemgroup = GUICtrlCreateGroup("Problem Group", 340, 680, 350, 65); << This group is transparent
    ;GUICtrlSetBkColor($problemgroup,0x000000); <<================================= This does not fix it
    $label = GUICtrlCreateLabel("Label", 350, 700, 200, 15)
    $button = GUICtrlCreateButton("Button",750, 680, 50, 25)
    GUISetState()

    While 1
        ;Sleep(50)
        $msg = GUIGetMsg()
        Select
            Case $msg = $button
                _PopupGUI()
        EndSelect
    WEnd
EndFunc   ;==>_Window

Func KillThemes($fState); <<============= Function found on forum, Thanks Melba23, and whoever wrote it.
    If Not StringInStr(@OSType, "WIN32_NT") Then Return 0
    If $fState Then
        $aOld_Theme = DllCall("uxtheme.dll", "int", "GetThemeAppProperties")
        DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
        Return 1
    ElseIf IsArray($aOld_Theme) Then
        DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $aOld_Theme[0])
        $aOld_Theme = ""
        Return 1
    EndIf
    Return 0
EndFunc   ;==>KillThemes

Func _Exit()
    KillThemes(False)
    Exit
EndFunc   ;==>_Exit

I can see the desktop through the group control which is ugly.

Would appreciate any tips to have it adopt the colour of the rest of the GUI ?


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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