Jump to content

Transparent Form and PNG


x001z
 Share

Recommended Posts

HI!

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

post-33047-0-45234500-1407890373_thumb.p

 

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)
GUICtrlSetBkColor($Pic1, $GUI_BKCOLOR_TRANSPARENT)


GUISetState()


_SetImage($Pic1, $sPng)


GUISetControlsVisible($Main_Gui)


GUISetState()

While 1
    If GUIGetMsg() = $But1 Then Exit
WEnd


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)
    Next
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aM_Mask[0], "int", 1)
EndFunc

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.

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