loveau3 Posted June 1, 2010 Posted June 1, 2010 (edited) PNG advanced applications HELP!!!!!!!!My PNG background not transparent This issue is related to PNG and PNG background with the trigger buttons to use PNG Button and PNG background ================================================================================================ My question now is not so transparent PNG background Stated: My PNG file is transparent, but not in actual use transparent hope that we can download the attachment to run ================================================================================================ I hope that we can download and then run the annex to answer my question. . . PNGBG+BUTTON.rar expandcollapse popup#Include <GUIConstantsEx.au3> #Include <Icons.au3> Opt('MustDeclareVars', 0) Global $Hold = False Global Const $sGreen = @ScriptDir & '\pic1_hover.png' Global Const $sRed = @ScriptDir & '\pic2.png' $hGreen = _Icons_Bitmap_Load("background.png") $hForm = GUICreate('GUICtrlSetOnHover & Icons UDFs Demonstration', 620,310,-1,-1, $WS_POPUP, $WS_EX_LAYERED) $T1=GUICtrlCreateButton("TEST BUTTON",300,1) $Back = GUICtrlCreatePic('', 0, 0, 680, 310) _SetHImage($Back,$hGreen) GUICtrlSetState(-1, $GUI_DISABLE) $Pic1 = GUICtrlCreatePic('', 1, 1, 256, 256) $hGreen = _Icons_Bitmap_Load($sGreen) $hRed = _Icons_Bitmap_Load($sRed) _SetHImage($Pic1, $hRed) GUISetState() $pCtrlID = 0 GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") While 1 $Cursor = GUIGetCursorInfo() If @error Then ContinueLoop EndIf $nCtrlID = $Cursor[4] If $nCtrlID <> $pCtrlID Then Switch $pCtrlID Case $Pic1 _SetHImage($Pic1, $hRed) EndSwitch Switch $nCtrlID Case $Pic1 Sleep(20) _SetHImage($Pic1, $hGreen) EndSwitch $pCtrlID = $nCtrlID EndIf $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE ExitLoop Case $T1 Exit EndSwitch WEnd GUIDelete() Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) If ($hWnd = $hForm) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION EndFunc ;==>WM_NCHITTEST ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ If you are worried about my PNG background Picture have problems you can run this script ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ expandcollapse popup#include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #Include <Constants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <GDIPlus.au3> #include <WinAPI.au3> Opt('MustDeclareVars', 0) Global $Hold = False Global Const $AC_SRC_ALPHA = 1 Global $old_string = "", $runthis = "" Global $launchDir = 'C:\' ; Load PNG file as GDI bitmap _GDIPlus_Startup() $pngSrc = @ScriptDir & '\background.png' $hImage = _GDIPlus_ImageLoadFromFile($pngSrc) $width = _GDIPlus_ImageGetWidth($hImage) $height = _GDIPlus_ImageGetHeight($hImage) ; Create layered window $GUI = GUICreate("lod3n launcher", $width, $height, -1, -1, $WS_POPUP, $WS_EX_LAYERED) SetBitmap($GUI, $hImage, 0) ; Register notification messages GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUISetState() WinSetOnTop($GUI, "", 1) ;fade in png background For $i = 0 To 255 Step 10 SetBitmap($GUI, $hImage, $i) Next GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) If ($hWnd = $GUI) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION EndFunc ;==>WM_NCHITTEST Func SetBitmap($hGUI, $hImage, $iOpacity) 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", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>SetBitmap ; Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False) Local Const $AC_SRC_ALPHA = 1 Local Const $ULW_ALPHA = 2 Local Const $LWA_ALPHA = 0x2 Local Const $LWA_COLORKEY = 0x1 If Not $isColorRef Then $i_transcolor = Hex(String($i_transcolor), 6) $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2)) EndIf Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA) Select Case @error Return SetError(@error, 0, 0) Case $Ret[0] = 0 Return SetError(4, 0, 0) Case Else Return 1 EndSelect EndFunc ;==>_API_SetLayeredWindowAttributes Edited June 1, 2010 by loveau3
UEZ Posted June 1, 2010 Posted June 1, 2010 Look here: http://www.autoitscript.com/forum/index.php?showtopic=104186, http://www.autoitscript.com/forum/index.php?showtopic=102961 Maybe it will help you... BR, UEZ 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
loveau3 Posted June 1, 2010 Author Posted June 1, 2010 (edited) Can directly modify the script to me I need to effect? thanks Give me a script example? Can not help you to achieve the effect I ===================== http://www.autoitscript.com/forum/index.php?showtopic=104186 ********#include <PngKong.au3>******** This example annex has expired ===================== Edited June 1, 2010 by loveau3
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now