Jump to content

Gui Transparancy issue


Recommended Posts

I am using a function I found on the forum to create a pop up window from the tray and customising it for my purpose. The issue I have is I am setting a background image but when I display the pop up gui it draws a white area for the text boxes. I would like to make the text box transparant so I can always see the background image.

Can I also ask if there is a way to fade the background image.

#Include <Misc.au3>
#Include <WinAPI.au3>
#include <Constants.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#include <array.au3>



$PopupX = 200
$PopupY = 70

$tb = WinGetPos("","Notification Area") ;array [x,y,width,height]
    $x = $tb[2] - $PopupX -30
    $y = $tb[1] - $PopupY -30

Tray_Gui ( "POPup Window", "StatusMessage", 0 )

Sleep(5000)

Func tray_gui($title, $text, $sound)

    ;$message = $title & @LF & @lf & $text


    Opt("GUICoordMode", 0)
    if FileExists(@ScriptDir & "\data\tray.wma") = True Then
        if $sound = 1 then SoundPlay(@ScriptDir & "\data\tray.wma", 0)
    endif


    $gui = GUICreate("popup", $PopupX, $PopupY, $x, $y, BitOR($WS_POPUPWINDOW, $WS_THICKFRAME, $WS_DISABLED, $DS_SETFOREGROUND), BitOR($WS_EX_CLIENTEDGE, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_TRANSPARENT))
    $background = GUICtrlCreatePic("C:\hard-drive.jpeg", 0, 0, $PopupX, $PopupY, BitOr($SS_CENTERIMAGE, $SS_WHITERECT)); background picture
    WinSetTrans("popup", "", 0)
    GUISetState(@SW_SHOW)
    ;ConsoleWrite($i & @CRLF)

    ;GUISetBkColor(0xE0FFFF)
    WinSetTrans("popup", "", 0)
    ;$rgn = _WinAPI_CreateRoundRectRgn(6, 6, 200, 70, 60, 10)
    ;_WinAPI_SetWindowRgn($gui, $rgn)
    GUISetFont(9, 800, 4)
    GUICtrlCreateLabel($Title, 5, 5 )
    GUISetFont(7, 600, 0)
    GUICtrlCreateLabel($text, 5, 23, 190, 40, -1, $WS_EX_TRANSPARENT)

    $i = 0

    Do
        $i = $i + 5
        WinSetTrans("popup", "", $i)
        sleep(30)
    until $i = 255


    sleep(5000)



    Do
        $i = $i - 5
        WinSetTrans("popup", "", $i)
        sleep(30)
    until $i = 0

    GUIDelete($gui)
EndFunc
Link to comment
Share on other sites

  • Moderators

bourny,

From the Help file for GUICtrlCreateLabel: ;)

To set the background to transparent, use GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT).

This works for me: :blink:

GUICtrlCreateLabel($Title, 5, 5 )
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUISetFont(7, 600, 0)
GUICtrlCreateLabel($text, 5, 23, 190, 40)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

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

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