Jump to content
Sign in to follow this  

Transparent gui and label box?

Recommended Posts


Hey guys

Ive been trying to find a way to make my GUI's more attractive. I used to use a program called QMB a few years ago where you could set a picture (in my case it will be the pic of the gui created in photoshop and saved as a jpg) and it would display on its own with no borders. You could then highlight areas and set a command for when they were clicked. I would like ot be able to display a picture on its own. then have empty label boxes (or something that would work) to be set over areas i would like but so that you cannot see them just the main gui pic underneath and then set labelclick to perform the function i want.

Anyone got any ideas on the transparent label pls?



Drunken Frat-Boy Monkey Garbage

Share this post

Link to post
Share on other sites


You do nto need labels or buttons - I use Malkey's excellent UDF to register clicks in user-defined shapes to do this - you can find it here. :unsure:

And in case it might come in handy, I do this to get the image to display without a GUI. :>


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:


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


Share this post

Link to post
Share on other sites

Try this:

;coded by UEZ 2011
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>

Global $hGUI, $hImage, $hGraphic, $hImage
Global Const $SC_DRAGMOVE = 0xF012
; Load PNG image
$hImage = _GDIPlus_ImageLoadFromFile("Audiograbber_512x512_transparent.png")
$iWidth = _GDIPlus_ImageGetWidth($hImage)
$iHeight = _GDIPlus_ImageGetHeight($hImage)

; Create GUI
$hGUI = GUICreate("Show PNG", $iWidth, $iHeight, -1, -1, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST)
$hGUI_child = GUICreate("", $iWidth, $iHeight, 0, 0, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST + $WS_EX_MDICHILD, $hGUI)
$hButton = GUICtrlCreateButton("Exit", $iWidth * 2 / 3, $iHeight * 2 / 3, 40, 40)
GUISetBkColor(0xFFFFFF, $hGUI_child)
GUISetState(@SW_SHOW, $hGUI)
GUISetState(@SW_SHOW, $hGUI_child)
SetTransparentBitmap($hGUI, $hImage)
_WinAPI_SetLayeredWindowAttributes($hGUI_child, 0xFFFFFF, 0xff)

$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI_child)
_GDIPlus_GraphicsSetSmoothingMode($hGraphic, 2)
DllCall($ghGDIPDll, "uint", "GdipSetTextRenderingHint", "handle", $hGraphic, "int", 4)
_GDIPlus_GraphicsDrawString($hGraphic, "GDI+ Full Transparency", 0, $iHeight / 2 - 20, "Arial", 24)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $hButton
            GUIRegisterMsg($WM_LBUTTONDOWN, "")

Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam)
    _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)

Func SetTransparentBitmap($hGUI, $hImage, $iOpacity = 0xFF)
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
    $hScrDC = _WinAPI_GetDC(0)
    $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))
    DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", $iOpacity)
    DllStructSetData($tBlend, "Format", 1)
    _WinAPI_UpdateLayeredWindow($hGUI,  $hMemDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
    _WinAPI_ReleaseDC(0, $hScrDC)
    _WinAPI_SelectObject($hMemDC, $hOld)
EndFunc   ;==>SetTransparentBitmap

Just replace line 9 with a transparent PNG of your choice.



Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post

Link to post
Share on other sites

Gentlemen - WOW as always. I cant wait to give these a try. Ill let you know how it comes :unsure:

Drunken Frat-Boy Monkey Garbage

Share this post

Link to post
Share on other sites

NICE JOB UEZ!!!!!!!!!!!!!!!!!!

:> this brings a lot of idea ;)

all i can say to all, try it and work it out ;)

Is this the line to set the trancpericy thickness ?

Func SetTransparentBitmap($hGUI, $hImage, $iOpacity = 0xFF)

( sorry if this looks obviuse to some :D but i wanna learn from it :unsure: )

Edited by FMS

as finishing touch god created the dutch

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.