Sign in to follow this  
Followers 0
jlorenz1

Transparent background of a label aren't shown or are grey

5 posts in this topic

#1 ·  Posted (edited)

TransparentLabel.au3:DI have a working script with surprising resultats, but without the intended solution. It's very easy: For a GUI window with a picture background I want to create a label with white font and a transparent background of the label, so that you can see the backgroundpicture of the GUI window.

My script can make parts of the background picture transparent, but the background of the labels appears grey or aren't shown.

And now in German. Ich habe ein funktionierendes Skript, das Teile des Hintergrundbildes eines GUI Fenster transparent setzt. Dies war aber nicht Absicht. Vielmehr wollte ich den Hintergrund des Labels

transparent machen, so daß man auf das dahinter liegende Hintergrundbild des GUI-Fensters sehen kann.

Es ist stark vereinfachtes Skript, probiert aus. Ihr werdet überrascht sein. Entweder wird das Label überhaupt nicht gezeigt oder der Hintergrund des Labels erscheint immer hellgrau. Wie schaffe ich dass daer Hintergrund des Labels transparent wird (Auf transparente Bildern mit Texten möchte ich nicht zurückgreifen)

Thanks in advance fo0r your help/ Im voraus besten Dank für Eure Hilfe Johannes

Edited by jlorenz1

Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]

Share this post


Link to post
Share on other sites



#cs
Version:            AutoIt 3.1.1
                    Windows XP necessary for JPG-File
Problem:            Transparent background of label with a normal background of an GUI window               
#ce

#include <GUIConstants.au3>
$LbLtxt="   I wanna have a white font with a transparent background as label;-)"

;>>>>>>>>>>>>>>>>>>>> main window <<<<<<<<<<<<<<<<<<<<<<<<<
$main=GUICreate("Transparent Label?",250,300,-1,-1)  
GUICtrlCreatePic(@Systemdir & "\oobe\images\wpakey.jpg",0,0, 248,281)
GUICtrlCreateLabel($LbLtxt,10,20,230,30)
    GUICtrlSetColor ( -1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$btn1=GUICtrlCreateButton('Next try',180,220,60,20)
;>>>>>>>>>>>>>>>>>>>> child window <<<<<<<<<<<<<<<<<<<<<<<<<
$child=GUICreate("Next Try",250,300,-1,-1,$WS_POPUP,$WS_EX_TRANSPARENT)  
GUICtrlCreatePic(@Systemdir & "\oobe\images\wpakey.jpg",0,0, 248,281)
GUICtrlCreateLabel($LbLtxt,10,20,230,30,-1,$WS_EX_TRANSPARENT)
    GUICtrlSetColor ( -1, 0xFFFFFF)
GUISwitch($main)    
GUISetState(@SW_SHOW)


; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg(1)
    Select
        Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $main 
            ExitLoop
        Case $msg[0]=$btn1 
            MsgBox(4096,'hier','',1)
            GUISwitch($child)
            GUISetState()
    EndSelect
    
Wend

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Sorry but I get the error message "Line 15 (File "J:\antwort.au3"):

GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

GUICtrlSetBkColor(-1, ^ ERROR

Error: Variable used without being declared.

I looked up in the GUIConstants.au3 and didn't find a declaration of this variable

#cs
Version:            AutoIt 3.1.1
                    Windows XP necessary for JPG-File
Problem:            Transparent background of label with a normal background of an GUI window               
#ce

#include <GUIConstants.au3>
$LbLtxt="   I wanna have a white font with a transparent background as label;-)"

;>>>>>>>>>>>>>>>>>>>> main window <<<<<<<<<<<<<<<<<<<<<<<<<
$main=GUICreate("Transparent Label?",250,300,-1,-1)  
GUICtrlCreatePic(@Systemdir & "\oobe\images\wpakey.jpg",0,0, 248,281)
GUICtrlCreateLabel($LbLtxt,10,20,230,30)
    GUICtrlSetColor ( -1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$btn1=GUICtrlCreateButton('Next try',180,220,60,20)
;>>>>>>>>>>>>>>>>>>>> child window <<<<<<<<<<<<<<<<<<<<<<<<<
$child=GUICreate("Next Try",250,300,-1,-1,$WS_POPUP,$WS_EX_TRANSPARENT)  
GUICtrlCreatePic(@Systemdir & "\oobe\images\wpakey.jpg",0,0, 248,281)
GUICtrlCreateLabel($LbLtxt,10,20,230,30,-1,$WS_EX_TRANSPARENT)
    GUICtrlSetColor ( -1, 0xFFFFFF)
GUISwitch($main)    
GUISetState(@SW_SHOW)
; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg(1)
    Select
        Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $main 
            ExitLoop
        Case $msg[0]=$btn1 
            MsgBox(4096,'hier','',1)
            GUISwitch($child)
            GUISetState()
    EndSelect
    
Wend

8)


Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]

Share this post


Link to post
Share on other sites

No resultats in qeries for $GUI_BKCOLOR_TRANSPARENT in helpfile and autoit database

Sorry but I get the error message "Line 15 (File "J:\antwort.au3"):

GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

GUICtrlSetBkColor(-1, ^ ERROR

Error: Variable used without being declared.

I looked up in the GUIConstants.au3 and didn't find a declaration of this variable


Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]

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