LayeredGui Label/Image

  • Nun hab ich doch tatsächlich ein neues Problem und eine Frage dazu.

    Ich habe folgende Funktion, welche einen Bild mit einem Label erstellen soll.

    Spoiler anzeigen
    [autoit]


    $hImageBG=_GDIPlus_ImageLoadFromFile($Image_BG)
    $GUI = GUICreate($Texts[0][$speach], 813, 1000, 0, 0, $WS_POPUP, BitOR($WS_EX_CONTROLPARENT, $WS_EX_LAYERED))
    SetBitmap($GUI, $hImageBG, 255)
    GUISetState(@SW_Show)

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

    $Form = GUICreate($Texts[0][$speach], 813, 1000,-1,-1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $GUI)
    GUISetState(@SW_SHOW)
    GUISetBkColor(0x585858)
    _WinAPI_SetLayeredWindowAttributes($Form, 0x585858)
    _createHeader($GUI,$Image_LL,$Image_LM,100,400,200,31,"Text2",0,0)

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

    Func _createHeader($GUI,$LeftImagePath,$MainImagePath,$BG_X,$BG_Y,$BG_Width,$BG_Height,$text,$x,$y,$width=-1,$height=-1,$style=-1,$exstyle=-1)
    $dll=DllStructCreate("HWND;HWND;HWND;int");window,pos1,pos2,width,height,wert,maxwert
    $Image=_GDIPlus_ImageLoadFromFile($LeftImagePath)
    $Image2=_GDIPlus_ImageLoadFromFile($MainImagePath)
    $hwnd = GUICreate("getGraphic",$BG_Width,$BG_Height)
    $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
    $bitmap = _GDIPlus_BitmapCreateFromGraphics($BG_Width, $BG_Height+11, $graphics)
    $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    ;_GDIPlus_ImageResize($backbuffer,$BG_Width,$BG_Height)
    _GDIPlus_GraphicsDrawImage($backbuffer,$Image,0,0)
    for $i=_GDIPlus_ImageGetWidth($Image)+11 to $BG_Width-(_GDIPlus_ImageGetWidth($Image)*2) step 1
    _GDIPlus_GraphicsDrawImage($backbuffer,$Image2,$i,0)
    next
    _GDIPlus_ImageRotateFlip($Image,4)
    _GDIPlus_GraphicsDrawImage($backbuffer,$Image,$BG_Width-(_GDIPlus_ImageGetWidth($Image)*2),0)
    GUIDelete($hwnd)
    DllStructSetData($dll,1,_GuiCtrlCreatePic($GUI,$bitmap,$BG_X,$BG_Y,true))
    GUISwitch($GUI)
    DllStructSetData($dll,2,GUICtrlCreateLabel($text,$x,$y,$width,$height,$style,$exstyle))
    EndFunc

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

    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

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

    Func _GuiCtrlCreatePic($gGui, $iPicture, $iX = 0, $iY = 0,$Image=false)
    local $gImage
    if $Image then
    $gImage = $iPicture
    else
    $gImage = _GDIPlus_ImageLoadFromFile($iPicture)
    endif
    $gWidth = _GDIPlus_ImageGetWidth($gImage)
    $gHeight = _GDIPlus_ImageGetHeight($gImage)
    $iGui = GUICreate("", $gWidth, $gHeight, $iX, $iY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $gGui)
    $iLabel = GUICtrlCreateLabel("", 0, 0, $gWidth, $gHeight)
    GUISetBkColor(0, $iGui)
    GUISetState(@SW_SHOW, $iGui)
    SetBitmap($iGui, $gImage,255)
    ;Local $iReturn[6] = [0, SetError(0, $iLabel,$iGui), $iX, $iY, $gWidth, $gHeight]
    GUISwitch($gGui)
    $iReturn=$iGui
    Return $iReturn
    EndFunc ;==>_GuiCtrlCreatePic

    [/autoit]

    Das HeaderHintergrundbild wird auch erstellt. Leider wird die Größe dabei verändert (siehe Bild: original oben). Obwohl nirgendwo eine Größenänderung durchgeführt werden soll.
    Außerdem ist das HeaderLabel hinter dem HeaderHintergrundbild versteckt. Wenn ich das HeaderHintergrundbild-GUI als erstellungsort nehme ist es natürlich unsichtbar. Wenn ich ein neues Fenster über dem Headerbild erstelle wird der Text dort auch nicht sichtbar...
    (Die Bilder sind .png)

    Ich hoffe ihr könnt mir helfen, und auch das Verändern der Größe erklären :)