Fenster mit Transparenten Teilen/Ecken

  • So seit langem habe ich auch nochmal ein Problem ^^ :P

    Ich wollte eine UDF schreiben um Fenster wie
    https://autoit.de/index.php?page…ttel#post140859
    zu erstellen (transparente Ecke oben links), also dass man Fesnter erstellen kann, wo nur ein Teil des Fensters bemalt wird (mit GDI+)
    Leider ist das bis jetzt daneben gegangen, bei meinem Test wird gar nichts angezeigt.

    Mein Code bis jetzt:

    Spoiler anzeigen
    [autoit]


    #include-once
    #include <GDIPlus.au3>
    #include <WindowsConstants.au3>
    #include <GUIConstantsex.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $gui=_CreateGUIT("Test",100,100,$WS_SYSMENU,0);BitOR($WS_EX_TOOLWINDOW,$WS_EX_TOPMOST)
    $brush=_GDIPlus_BrushCreateSolid(0xFF00FF00)
    while GUIGetMsg()<>-3
    _GDIPlus_GraphicsFillEllipse($gui[5],0,0,100,100,$brush)
    _DrawonGUIT($gui)
    Sleep(10)
    WEnd
    _GDIPlus_BrushDispose($brush)
    _DeleteGUIT($gui)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _CreateGUIT($title="",$width=400,$height=400,$style=0,$exstyle=0,$parent=0)
    Local $gui[9];GUI,ScreenDC,DC,Graphics,Buffer,Backbuffer,Size,Point,Blend
    _GDIPlus_Startup()
    $gui[0]=GUICreate($title,$width,$height,Default,Default,BitOR($WS_POPUP,$style),BitOR($WS_EX_LAYERED,$exstyle),$parent)
    $gui[1]=_WinAPI_GetDC($gui[0])
    $gui[2]=_WinAPI_CreateCompatibleDC($gui[1])
    $gui[3]=_GDIPlus_GraphicsCreateFromHWND($gui[0])
    $gui[4]=_GDIPlus_BitmapCreateFromGraphics($width,$height,$gui[3])
    $gui[5]=_GDIPlus_ImageGetGraphicsContext($gui[4])
    _GDIPlus_GraphicsSetSmoothingMode($gui[5],4) ;bringt das etwas?
    Local $tSize = DllStructCreate($tagSIZE)
    $gui[6] = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", $width)
    DllStructSetData($tSize, "Y", $height)
    Local $tSource = DllStructCreate($tagPOINT)
    $gui[7] = DllStructGetPtr($tSource)
    Local $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $gui[8] = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", 255)
    DllStructSetData($tBlend, "Format", 1)
    ;_DrawonGUIT($gui)
    GUISetState(@SW_SHOW,$gui[0])
    Return $gui
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _DrawonGUIT($theguiarray)
    if not isarray($theguiarray) then return seterror(1,0,0)
    Local $hbmp=_GDIPlus_BitmapCreateHBITMAPFromBitmap($theguiarray[4])
    _WinAPI_SelectObject($theguiarray[2], $hbmp)
    _WinAPI_UpdateLayeredWindow($theguiarray[0], $theguiarray[1], 0, $theguiarray[6], $theguiarray[2], $theguiarray[7], 0, $theguiarray[8], 2)
    _WinAPI_DeleteObject($hbmp)
    Return SetError(0,0,1)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _DeleteGUIT(ByRef $theguiarray)
    if not isarray($theguiarray) then return seterror(1,0,0)
    $theguiarray[8]=0
    $theguiarray[7]=0
    $theguiarray[6]=0
    _GDIPlus_GraphicsDispose($theguiarray[5])
    _GDIPlus_BitmapDispose($theguiarray[4])
    _GDIPlus_GraphicsDispose($theguiarray[3])
    _WinAPI_DeleteDC($theguiarray[2])
    _WinAPI_ReleaseDC($theguiarray[0],$theguiarray[1])
    GUIDelete($theguiarray[0])
    ReDim $theguiarray[1]
    _GDIPlus_Shutdown()
    Return SetError(0,0,1)
    EndFunc

    [/autoit]

    Hoffe, dass ihr mir helfen könnt :)