Guten Tag,
Ich habe folgendes Problem:
meine Popup-GUI besteht aus vielen PNG-Dateien. Wenn ich jetzt ein $WM_PAINT-Ereignis auslöse, dann werden sämtliche png's einzeln neu gezeichnet. Und das dauert lange! (also ein paar ms zu viel für mich)
Dabei ist es gar nicht nötig alles neu übereinander zu legen.
Ich möchte einzelne Bild(PNG)-Gruppen, schon vorher übereinanderlegen lassen, und dann bei Bedarf ($WM_PAINT) nur das komplette Gruppenbild einfügen.
Geht das?
Hier mal ein ganz kleines bisschen Code, ich hoffe das hilft... (Skript nicht ganz lauffähig, aber ich denke was ich möchte wird klar)
Spoiler anzeigen
#include-once
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
_GDIPlus_Startup()
; Set accelerators
Global $SC_Width = 600
Global $SC_Height = 526
Global $SC_Titlebar_Height = 26
Global $hWnd_SC = GUICreate('GUI', $SC_Width, $SC_Height, -1, -1,$WS_POPUP); $WS_CLIPCHILDREN;
GUISetOnEvent($GUI_EVENT_CLOSE, "_exitMain")
;~ Global $hWnd_Chips = GUICreate("", 169, 68, 0, 0, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_MDICHILD, $hWnd_SC)
;~ GUISetState(@SW_SHOW)
;~ WinWait('GUI')
Global $Lbl_Title = GUICtrlCreateLabel('', 0, 0, $SC_Width, $SC_Titlebar_Height, -1, $GUI_WS_EX_PARENTDRAG )
Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd_SC)
; these Controls are invisible, but have correct position for user interaction
Global $SC_Btn_Dim = 16
Global $XClose = GUICtrlCreateLabel('',$SC_Width- $SC_Btn_Dim, 0, $SC_Btn_Dim, $SC_Btn_Dim)
GUICtrlSetOnEvent($XClose, "_exitMain")
GUICtrlSetState ( $XClose, $GUI_ONTOP )
;these Controls have no dimension, only for functions fired by Hotkeys;
Global $Lbl_Redraw_GUI = GUICtrlCreateLabel('',0,0,0,0)
GUICtrlSetOnEvent($Lbl_Redraw_GUI, "_Redraw_GUI")
Dim $Arr_AccelKeys[2][2]=[ _
['{SPACE}', $Lbl_Redraw_GUI], _
["!q", $XClose] _
]
GUISetAccelerators($Arr_AccelKeys,$hWnd_SC)
GUISetState()
GUIRegisterMsg($WM_PAINT, "_Redraw_GUI")
While True
Sleep(1000)
WEnd
Func _Redraw_GUI()
_WinAPI_RedrawWindow ($hWnd_SC, 0, 0, $RDW_UPDATENOW)
_GDIPlus_GraphicsDrawImageRect ($hGraphic, $hImg_Pic, 3, 26, 600, 500) ; Bild
_GDIPlus_GraphicsDrawImage ($hGraphic, $hImg_MinBG, 3, 429) ; IconHintergrund
;Diese Bilder hier möchte ich in eine Gruppe fassen, damit ich nur einen Befehl habe: _GDIPlus_GraphicsDrawImage ( $hGraphic, hImg_Icon, 10, 440)
local $SC_Icon_Dim=10
_GDIPlus_GraphicsDrawImageRectRect ($hGraphic, $hImg_Icon1, 0, 0, $SC_Icon_Dim, $SC_Icon_Dim, 10, 0*($SC_Icon_Dim+10)+440 , $SC_Icon_Dim, $SC_Icon_Dim) ; FooterIcon
_GDIPlus_GraphicsDrawImageRectRect ($hGraphic, $hImg_Icon2, 0, 0, $SC_Icon_Dim, $SC_Icon_Dim, 10, 1*($SC_Icon_Dim+10)+440 , $SC_Icon_Dim, $SC_Icon_Dim) ; FooterIcon
_GDIPlus_GraphicsDrawImageRectRect ($hGraphic, $hImg_Icon3, 0, 0, $SC_Icon_Dim, $SC_Icon_Dim, 10, 2*($SC_Icon_Dim+10)+440 , $SC_Icon_Dim, $SC_Icon_Dim) ; FooterIcon
_GDIPlus_GraphicsDrawImageRectRect ($hGraphic, $hImg_Icon4, 0, 0, $SC_Icon_Dim, $SC_Icon_Dim, 10, 3*($SC_Icon_Dim+10)+440 , $SC_Icon_Dim, $SC_Icon_Dim) ; FooterIcon
; Hier folgen Viele weitere Bilder
Return $GUI_RUNDEFMSG
EndFunc
Func _exitMain()
;~ _CollectGarbage()
_GDIPlus_Shutdown()
Exit
EndFunc ;==> _exitMain
Ich bedanke mich
JStaxton