Jump to content

Transparent background


Freequency
 Share

Recommended Posts

I'm trying to create two simple buttons, a status message, with a picture that will show through the background. I don't want the buttons to be transparent. Meaning the checkbox's, status message. I can't seem to get the groups to show the image? I've included the script and image. Thanks for any help.

Posted Image

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Please select to continue", 271, 190, 223, 126)
$Group1 = GUICtrlCreateGroup("Settings", 8, 8, 257, 97)
GUICtrlSetColor(-1, 0xFF0000)
$Checkbox1 = GUICtrlCreateCheckbox("Start", 32, 72, 57, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Pwned", 192, 72, 57, 17)
$Button1 = GUICtrlCreateButton("Start", 24, 24, 73, 41, $WS_GROUP)
$Button3 = GUICtrlCreateButton("Pwned!!", 184, 24, 73, 41, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Status", 8, 112, 257, 65)
GUICtrlSetColor(-1, 0xFF0000)
$Label2 = GUICtrlCreateLabel("What's Next?", 48, 144, 161, 17, $SS_CENTER)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Pic1 = GUICtrlCreatePic("freeqavatar.jpg", 0, 0, 268, 188, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICheckBoxSetColor ( $Checkbox1 ,0x000000,$GUI_BKCOLOR_TRANSPARENT)
GUICheckBoxSetColor ( $Checkbox2 ,0x000000,$GUI_BKCOLOR_TRANSPARENT)
GUISetState(@SW_SHOW)

Func GUICheckBoxSetColor(ByRef $CtrlID,$iColor,$iBkColor="0xF1EDED")
    $CtrlHWnd = $CtrlID
    If Not IsHWnd($CtrlHWnd) Then $CtrlHWnd = GUICtrlGetHandle($CtrlID)
    $aParent = DllCall("user32.dll", "hwnd", "GetParent", "hwnd", $CtrlHWnd)
    $aCPos = ControlGetPos($aParent[0],"",$CtrlID)
    $sOldT = GUICtrlRead($CtrlID,1)
    GUICtrlDelete($CtrlID)
    DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'int', 0)
    $CtrlID = GUICtrlCreateCheckbox($sOldT,$aCPos[0],$aCPos[1],$aCPos[2],$aCPos[3])
    GUICtrlSetColor(-1,$iColor)
    GUICtrlSetBkColor(-1,$iBkColor)
    DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'int', 7)
EndFunc


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
Link to comment
Share on other sites

Was playing around with it and I moved

$Pic1 = GUICtrlCreatePic("freeqavatar.jpg", 0, 0, 268, 188, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

right below the

$Form1 = GUICreate("Please select to continue", 271, 190, 223, 126)

Which got me to this image:post-51714-12665577701096_thumb.jpg

So now how do I get the text to only be visible and not the box around it?

Link to comment
Share on other sites

Try this;

$Label2 = GUICtrlCreateLabel("What's Next?", 48, 144, 161, 17, $SS_CENTER)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

This does not work on checkboxes. The best thing you can do with checkboxes is to create a label next to it, and make the label transparant while the checkbox is minimized till only the "check" is left... i don't know how to get the other controls transparant.

Link to comment
Share on other sites

Try this;

$Label2 = GUICtrlCreateLabel("What's Next?", 48, 144, 161, 17, $SS_CENTER)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

This does not work on checkboxes. The best thing you can do with checkboxes is to create a label next to it, and make the label transparant while the checkbox is minimized till only the "check" is left... i don't know how to get the other controls transparant.

That worked wonderfully, I'll do as you stated and make a label next to them. Thanks for the ideas. Any one know how to get the Groups to show transparent?
Link to comment
Share on other sites

  • Moderators

Freequency,

Does this help?

$Group2 = GUICtrlCreateGroup("", 8, 112, 257, 65)
GUICtrlCreateLabel("Status", 20, 122, 40, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

You can do the top one yourself if you like it! :mellow:

M23

P.S. You need to disable your Pic control if you want the others to work! :(

$Pic1 = GUICtrlCreatePic("freeqavatar.jpg", 0, 0, 268, 188, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetState(-1, $GUI_DISABLE)
Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Freequency,

Does this help?

$Group2 = GUICtrlCreateGroup("", 8, 112, 257, 65)
GUICtrlCreateLabel("Status", 20, 122, 40, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

You can do the top one yourself if you like it! :mellow:

M23

It sets the status color to white, but I still have the background box around it.

Also I did create the GuiCtrlSetState(-1,$GUI_DISABLE)to activate the script. Didn't put it in the code when I pasted it here.

Link to comment
Share on other sites

  • Moderators

Freequency,

If you do not want the box, then why are you using GUICtrlCreateGroup? Just leave that line out and just use the label. :mellow:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Yea, that will have to do.. lol good point!

If you want a transparent box then an easy way is to create lines from labels with no text.

EG

GuiCtrlCreateLabel("",10,10,230,2)

GuiCtrlSetBkColor(-1,0x444444)

Possibly a bit late now though :mellow:

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...