Jump to content
Sign in to follow this  
Kickassjoe

GDIPlus Background and Clickable Transparent Labels

Recommended Posts

Kickassjoe

So, I am trying to make clickable transparent labels on the controlGUI in this program. The labels are clickable, up until the point that they turn transparent, and I was wondering if it's easily possible to make them clickable while being transparent.

There's just 1 big label in the program right now, for testing purposes. If you make the label use the default background color, you will see that a message box pops up when you click it. When it is transparent, that doesn't happen, which is what I'm trying to make happen.

#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <INet.au3>
#include <GDIPlus.au3>
#include <GuiComboBox.au3>
#include <File.au3>
#include <Array.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>


Global Const $AC_SRC_ALPHA = 1
Global $old_string = "", $runthis = ""

_GDIPlus_Startup()
$pngSrc = @ScriptDir & "\images\bg.png"
$hImage = _GDIPlus_ImageLoadFromFile($pngSrc)

$width = _GDIPlus_ImageGetWidth($hImage)
$height = _GDIPlus_ImageGetHeight($hImage)

$GUI = GUICreate("LadderSearch", $width, $height, -1, -1, $WS_POPUP, $WS_EX_LAYERED)

GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
GUISetState()
WinSetOnTop($GUI, "", 1)

SetBitmap($GUI, $hImage, 0)
For $i = 0 To 255 Step 3
    SetBitmap($GUI, $hImage, $i)
Next

$controlGui = GUICreate("ControlGUI", $width, $height, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $GUI)

GUICtrlCreatePic(@ScriptDir & "\images\grey.gif", 0, 0, $width, $height)
GUICtrlSetState(-1, $GUI_DISABLE)

$bigButton = GUICtrlCreateLabel("", 0, 0, 300, 300, $SS_NOTIFY)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT);remove this line and the label will work...

GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $bigButton
            MsgBox(0,0,0)
    EndSelect
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

http://dknightstudios.org/files/test1.zip <-- uploaded to a server that I have access to because max file size is 12.15k, and the files are bigger than that, hope it's not a problem.

Edited by Kickassjoe

What goes around comes around... Payback's a bitch.

Share this post


Link to post
Share on other sites
smashly

So, I am trying to make clickable transparent labels on the controlGUI in this program. The labels are clickable, up until the point that they turn transparent, and I was wondering if it's easily possible to make them clickable while being transparent.

There's just 1 big label in the program right now, for testing purposes. If you make the label use the default background color, you will see that a message box pops up when you click it. When it is transparent, that doesn't happen, which is what I'm trying to make happen.

#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <INet.au3>
#include <GDIPlus.au3>
#include <GuiComboBox.au3>
#include <File.au3>
#include <Array.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>


Global Const $AC_SRC_ALPHA = 1
Global $old_string = "", $runthis = ""

_GDIPlus_Startup()
$pngSrc = @ScriptDir & "\images\bg.png"
$hImage = _GDIPlus_ImageLoadFromFile($pngSrc)

$width = _GDIPlus_ImageGetWidth($hImage)
$height = _GDIPlus_ImageGetHeight($hImage)

$GUI = GUICreate("LadderSearch", $width, $height, -1, -1, $WS_POPUP, $WS_EX_LAYERED)

GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
GUISetState()
WinSetOnTop($GUI, "", 1)

SetBitmap($GUI, $hImage, 0)
For $i = 0 To 255 Step 3
    SetBitmap($GUI, $hImage, $i)
Next

$controlGui = GUICreate("ControlGUI", $width, $height, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $GUI)

GUICtrlCreatePic(@ScriptDir & "\images\grey.gif", 0, 0, $width, $height)
GUICtrlSetState(-1, $GUI_DISABLE)

$bigButton = GUICtrlCreateLabel("", 0, 0, 300, 300, $SS_NOTIFY)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT);remove this line and the label will work...

GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $bigButton
            MsgBox(0,0,0)
    EndSelect
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

http://dknightstudios.org/files/test1.zip <-- uploaded to a server that I have access to because max file size is 12.15k, and the files are bigger than that, hope it's not a problem.

Hi, I don't have an answer for the Layered windows with trans labels catching clicks, but I did it with a normal window and get similar results to what your after using WinSetStrans()..

I know it's not what your after, but I'll post it anyway..lol

I used minimize and exit labels for example..

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>

Global $hGUI, $Pic, $Exit, $Minimize
Global $pngSrc = @ScriptDir & "\images\bg.png"
Global $aImg = _GetWHI($pngSrc)

$hGUI = GUICreate("", $aImg[0], $aImg[1], -1, -1, $WS_POPUP, $WS_EX_TOPMOST)
$Pic = GUICtrlCreatePic("", 0, 0, $aImg[0], $aImg[1])
GUICtrlSetState(-1, $GUI_DISABLE)
_hBmpToPicControl($Pic, $aImg[2], 1)
WinSetTrans($hGUI, "", 0)
$Exit = GUICtrlCreateLabel("", 671, 3, 15, 15)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$Minimize = GUICtrlCreateLabel("", 651, 3, 15, 15)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUISetState()

GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")

_Fade($hGUI, 0)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $Exit
            _Fade($hGUI, 1)
            Exit
        Case $Minimize
            GUISetState(@SW_MINIMIZE, $hGUI)
    EndSwitch
WEnd

; $sImage = Path to your image
; Returns = Array[3]
;         Array[0] = Width
;         Array[1] = Height
;         Array[2] = handle to a HBITMAP
Func _GetWHI($sImage)
    Local $hImage, $aRet[3]
    _GDIPlus_Startup()
    $hImage = _GDIPlus_ImageLoadFromFile($sImage)
    $aRet[0] = _GDIPlus_ImageGetWidth($hImage)
    $aRet[1] = _GDIPlus_ImageGetHeight($hImage)
    $aRet[2] = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_Shutdown()
    Return $aRet
EndFunc   ;==>_GetWHI

; $iCID = Control ID as returned from GUICtrlCreatePic()
; $hBmp = HBITMAP as returned by _GetWHI()
; $iFlag = Set to 1 will delete the $hBmp object after setting it the pic control
Func _hBmpToPicControl($iCID, $hBmp, $iFlag = 0)
    Local Const $STM_SETIMAGE = 0x0172
    Local Const $IMAGE_BITMAP = 0
    Local $hOldBmp
    $hOldBmp = GUICtrlSendMsg($iCID, $STM_SETIMAGE, $IMAGE_BITMAP, $hBmp)
    If $hOldBmp Then _WinAPI_DeleteObject($hOldBmp)
    If $iFlag Then _WinAPI_DeleteObject($hBmp)
EndFunc   ;==>_hBmpToPicControl

; $iFlag = 0 fade in, 1 fadeout
Func _Fade($hWnd, $iFlag)
    Local $b = 0, $e = 252, $s = +3
    If $iFlag Then
        $b = 252
        $e = 0
        $s = -3
    EndIf
    For $i = $b To $e Step $s
        WinSetTrans($hWnd, "", $i)
    Next
EndFunc   ;==>_Fade

Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
    If ($hWnd = $hGUI) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION
EndFunc   ;==>WM_NCHITTEST
Edited by smashly

Share this post


Link to post
Share on other sites
Kickassjoe

Hi, I don't have an answer for the Layered windows with trans labels catching clicks, but I did it with a normal window and get similar results to what your after using WinSetStrans()..

I know it's not what your after, but I'll post it anyway..lol

I used minimize and exit labels for example..

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>

Global $hGUI, $Pic, $Exit, $Minimize
Global $pngSrc = @ScriptDir & "\images\bg.png"
Global $aImg = _GetWHI($pngSrc)

$hGUI = GUICreate("", $aImg[0], $aImg[1], -1, -1, $WS_POPUP, $WS_EX_TOPMOST)
$Pic = GUICtrlCreatePic("", 0, 0, $aImg[0], $aImg[1])
GUICtrlSetState(-1, $GUI_DISABLE)
_hBmpToPicControl($Pic, $aImg[2], 1)
WinSetTrans($hGUI, "", 0)
$Exit = GUICtrlCreateLabel("", 671, 3, 15, 15)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$Minimize = GUICtrlCreateLabel("", 651, 3, 15, 15)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUISetState()

GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")

_Fade($hGUI, 0)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $Exit
            _Fade($hGUI, 1)
            Exit
        Case $Minimize
            GUISetState(@SW_MINIMIZE, $hGUI)
    EndSwitch
WEnd

; $sImage = Path to your image
; Returns = Array[3]
;         Array[0] = Width
;         Array[1] = Height
;         Array[2] = handle to a HBITMAP
Func _GetWHI($sImage)
    Local $hImage, $aRet[3]
    _GDIPlus_Startup()
    $hImage = _GDIPlus_ImageLoadFromFile($sImage)
    $aRet[0] = _GDIPlus_ImageGetWidth($hImage)
    $aRet[1] = _GDIPlus_ImageGetHeight($hImage)
    $aRet[2] = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_Shutdown()
    Return $aRet
EndFunc   ;==>_GetWHI

; $iCID = Control ID as returned from GUICtrlCreatePic()
; $hBmp = HBITMAP as returned by _GetWHI()
; $iFlag = Set to 1 will delete the $hBmp object after setting it the pic control
Func _hBmpToPicControl($iCID, $hBmp, $iFlag = 0)
    Local Const $STM_SETIMAGE = 0x0172
    Local Const $IMAGE_BITMAP = 0
    Local $hOldBmp
    $hOldBmp = GUICtrlSendMsg($iCID, $STM_SETIMAGE, $IMAGE_BITMAP, $hBmp)
    If $hOldBmp Then _WinAPI_DeleteObject($hOldBmp)
    If $iFlag Then _WinAPI_DeleteObject($hBmp)
EndFunc   ;==>_hBmpToPicControl

; $iFlag = 0 fade in, 1 fadeout
Func _Fade($hWnd, $iFlag)
    Local $b = 0, $e = 252, $s = +3
    If $iFlag Then
        $b = 252
        $e = 0
        $s = -3
    EndIf
    For $i = $b To $e Step $s
        WinSetTrans($hWnd, "", $i)
    Next
EndFunc   ;==>_Fade

Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
    If ($hWnd = $hGUI) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION
EndFunc   ;==>WM_NCHITTEST

It didn't really fade in for me, don't know if that's just my computer, or what, so I added a 10 ms sleep to the winsettrans loop, and put the max down to 245, and it's almost exactly how transparent it was before >_<. Thanks for the help, I think that's all I need it to do :(.

What goes around comes around... Payback's a bitch.

Share this post


Link to post
Share on other sites
smashly

Hi, glad it sort of worked >_<

Here's another version of using just one layered window.

Clicks on trans labels labels work fine, but putting text on a label won't work.

Just means if your needing text you'll have to add text to the back image on the fly with gdi+ or have multiple background images to load on different event's

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>

Global $GUI, $Exit, $Minimize, $Last
Global $pngSrc = @ScriptDir & "\images\bg.png"
Global $aBmp = _GetWHI($pngSrc)

$GUI = GUICreate("LadderSearch", $aBmp[0], $aBmp[1], -1, -1, $WS_POPUP, BitOr($WS_EX_LAYERED, $WS_EX_TOPMOST))
$Minimize = GUICtrlCreateLabel("", $aBmp[0] - 44, 3, 15, 15)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$Exit = GUICtrlCreateLabel("", $aBmp[0] - 24, 3, 15, 15)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlCreateLabel("", 0, 0, $aBmp[0], $aBmp[1], 15, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUISetState(@SW_SHOW, $GUI)

_Fade($GUI, $aBmp, 0)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $Exit
            _Fade($GUI, $aBmp, 1)
            _WinAPI_DeleteObject($aBmp[2])
            Exit
        Case $Minimize
            GUISetState(@SW_MINIMIZE, $GUI)
    EndSwitch
WEnd

; $sImage = Path to your image
; Returns = Array[3]
;         $Array[0] = Width
;         $Array[1] = Height
;         $Array[2] = handle to a HBITMAP
; when the image is no longer needed use _WinAPI_DeleteObject($Array[2])
Func _GetWHI($sImage)
    Local $hImage, $aBitmap[3]
    _GDIPlus_Startup()
    $hImage = _GDIPlus_ImageLoadFromFile($sImage)
    $aBitmap[0] = _GDIPlus_ImageGetWidth($hImage)
    $aBitmap[1] = _GDIPlus_ImageGetHeight($hImage)
    $aBitmap[2] = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_Shutdown()
    Return $aBitmap
EndFunc   ;==>_GetWHI

; I changed this so I could shutdown gdiplus once an image has been loaded by _GetWHI()
; just pass it the array returned by _GetWHI()
Func SetBitmap($hGUI, $aBitmap, $iOpacity)
    Local Const $AC_SRC_ALPHA = 1
    Local $hScrDC, $hMemDC, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
    $hScrDC = _WinAPI_GetDC(0)
    $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
    $hOld = _WinAPI_SelectObject($hMemDC, $aBitmap[2])
    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", $aBitmap[0])
    DllStructSetData($tSize, "Y", $aBitmap[1])
    $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_DeleteDC($hMemDC)
EndFunc   ;==>SetBitmap

; $aBitmap = just pass it the array returned by _GetWHI()
; $iFlag = 0 fade in, 1 fade out
Func _Fade($hGUI, $aBitmap, $iFlag = 0)
    Local $b = 0, $e = 255, $s = +3
    If $iFlag Then
        $b = 255
        $e = 0
        $s = -3
    EndIf
    For $i = $b To $e Step $s
        SetBitmap($hGUI, $aBitmap, $i)
    Next
EndFunc   ;==>_Fade

Cheers

Share this post


Link to post
Share on other sites
Kickassjoe

Hi, glad it sort of worked >_<

Here's another version of using just one layered window.

Clicks on trans labels labels work fine, but putting text on a label won't work.

Just means if your needing text you'll have to add text to the back image on the fly with gdi+ or have multiple background images to load on different event's

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>

Global $GUI, $Exit, $Minimize, $Last
Global $pngSrc = @ScriptDir & "\images\bg.png"
Global $aBmp = _GetWHI($pngSrc)

$GUI = GUICreate("LadderSearch", $aBmp[0], $aBmp[1], -1, -1, $WS_POPUP, BitOr($WS_EX_LAYERED, $WS_EX_TOPMOST))
$Minimize = GUICtrlCreateLabel("", $aBmp[0] - 44, 3, 15, 15)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$Exit = GUICtrlCreateLabel("", $aBmp[0] - 24, 3, 15, 15)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlCreateLabel("", 0, 0, $aBmp[0], $aBmp[1], 15, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUISetState(@SW_SHOW, $GUI)

_Fade($GUI, $aBmp, 0)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $Exit
            _Fade($GUI, $aBmp, 1)
            _WinAPI_DeleteObject($aBmp[2])
            Exit
        Case $Minimize
            GUISetState(@SW_MINIMIZE, $GUI)
    EndSwitch
WEnd

; $sImage = Path to your image
; Returns = Array[3]
;         $Array[0] = Width
;         $Array[1] = Height
;         $Array[2] = handle to a HBITMAP
; when the image is no longer needed use _WinAPI_DeleteObject($Array[2])
Func _GetWHI($sImage)
    Local $hImage, $aBitmap[3]
    _GDIPlus_Startup()
    $hImage = _GDIPlus_ImageLoadFromFile($sImage)
    $aBitmap[0] = _GDIPlus_ImageGetWidth($hImage)
    $aBitmap[1] = _GDIPlus_ImageGetHeight($hImage)
    $aBitmap[2] = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_Shutdown()
    Return $aBitmap
EndFunc   ;==>_GetWHI

; I changed this so I could shutdown gdiplus once an image has been loaded by _GetWHI()
; just pass it the array returned by _GetWHI()
Func SetBitmap($hGUI, $aBitmap, $iOpacity)
    Local Const $AC_SRC_ALPHA = 1
    Local $hScrDC, $hMemDC, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
    $hScrDC = _WinAPI_GetDC(0)
    $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
    $hOld = _WinAPI_SelectObject($hMemDC, $aBitmap[2])
    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", $aBitmap[0])
    DllStructSetData($tSize, "Y", $aBitmap[1])
    $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_DeleteDC($hMemDC)
EndFunc   ;==>SetBitmap

; $aBitmap = just pass it the array returned by _GetWHI()
; $iFlag = 0 fade in, 1 fade out
Func _Fade($hGUI, $aBitmap, $iFlag = 0)
    Local $b = 0, $e = 255, $s = +3
    If $iFlag Then
        $b = 255
        $e = 0
        $s = -3
    EndIf
    For $i = $b To $e Step $s
        SetBitmap($hGUI, $aBitmap, $i)
    Next
EndFunc   ;==>_Fade

Cheers

The first example worked with the transparent labels, and with text, so I just stuck with that, and the program is finished now :(. The solution really did help a lot! Thanks for multiple options though :(.

What goes around comes around... Payback's a bitch.

Share this post


Link to post
Share on other sites
blackman12

While i am using this (in first code tags) script, any object cant visible and dont work.How i use this code with object?

i solve that problem with child window.

Edited by blackman12

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  

×