Jump to content
Sign in to follow this  

Transparent Form and PNG

Recommended Posts


I want to make a volume OSD, I made a pic to explain what I want to do.



I'm tryin to use a png files and a transparent backgound but i can make it wok, search a lot but still can make it.

Try to load the png with transparency to a ctrlpic and can make it transparent but not the form

Tried load the png without the control pic but the image completely dissapear.

Made the form transparent but not the pic control background, the las thing i did was...

using icons udf and excample from here

#Include <Icons.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <GuiConstantsEx.au3>

Global $hGraphic,$hGUI

$Main_Gui = GUICreate("", 400, 400, 20, 20, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)

$But1 = GUICtrlCreateButton(" Exit ", 100, 100, 80, 21)
$Info_Edit = GUICtrlCreateEdit("A few words to start off with", 80, 150, 300, 220)

$sPng = "barra2.png"

; $Form = GUICreate('Test', 253, 244)

$Pic1 = GUICtrlCreatePic('', 0, 0, 193, 184)


_SetImage($Pic1, $sPng)



While 1
    If GUIGetMsg() = $But1 Then Exit

Func GUISetControlsVisible($hWnd)
    Local $aM_Mask, $aCtrlPos, $aMask, $aLastID

    $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0)
    $aLastID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", GUICtrlGetHandle(-1))

    For $i = 3 To $aLastID[0]
        $aCtrlPos = ControlGetPos($hWnd, '', $i)
        If Not IsArray($aCtrlPos) Then ContinueLoop

        $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", _
            "long", $aCtrlPos[0], _
            "long", $aCtrlPos[1], _
            "long", $aCtrlPos[0] + $aCtrlPos[2], _
            "long", $aCtrlPos[1] + $aCtrlPos[3])
        DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2)
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aM_Mask[0], "int", 1)

only the button and the edit are transparent but the pic control, can someone point me to the right direction, I'm not seen it :(

Thanks in advance.

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  

  • Create New...