Hallo Leute ich habe mir gedacht, ich schreibe einfach mal eine ImageGUI UDF also eine UDF die es erleichtert, eine GUI zu basteln, die auf Grafiken Basiert.
Ich habe mir den Code zusammengeschrieben, doch will es nicht so ganz funktionieren. Hier mal der Code:
Spoiler anzeigen
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>
#Include <WinAPI.au3>
_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]Global $hGUI, $iWidth, $iHeight, $hGrafics1, $iwExit, $ihExit, $iwMax, $ihMax, $iwMin, $ihMin, $MainImage, $ExitImage, $MaxImage, $MinImage, $hExit, $hMax, $hMin
Global Const $SC_DRAGMOVE = 0xF012
Func _ImageGUI_Create($GUIImage, $ExitImage, $MaxImage, $MinImage)
; Lade Images für GUI
$MainImage = _GDIPlus_ImageLoadFromFile($GUIImage)
$hExit = _GDIPlus_BitmapCreateFromFile($ExitImage)
$hMax = _GDIPlus_BitmapCreateFromFile($MaxImage)
$hMin = _GDIPlus_BitmapCreateFromFile($MinImage)
;==================================================
; GUIImage Größe ermitteln
$iWidth = _GDIPlus_ImageGetWidth($MainImage)
$iHeight = _GDIPlus_ImageGetHeight($MainImage)
;==================================================
; erstelle GUI
$hGUI = GUICreate("", $iWidth, $iHeight, 192, 124, $WS_POPUP, $WS_EX_LAYERED)
GUISetBkColor(0x01, $hGUI)
GUISetState(@SW_SHOW)
_WinAPI_SetLayeredWindowAttributes($hGUI, 0x01, 0xFF, 3)
;==================================================
;Exit-, Max- und MinImage Größe ermitteln
$iwExit = _GDIPlus_ImageGetWidth($hExit)
$ihExit = _GDIPlus_ImageGetHeight($hExit)
$iwMax = _GDIPlus_ImageGetWidth($hMax)
$ihMax = _GDIPlus_ImageGetHeight($hMax)
$iwMin = _GDIPlus_ImageGetWidth($hMin)
$ihMin = _GDIPlus_ImageGetHeight($hMin)
;==================================================
; zeige Grafiken an
_GDIPlus_GraphicsDrawImage($hGrafics1, $MainImage, 0, 0)
_GDIPlus_GraphicsDrawImage($hGrafics1, $hExit, $iWidth -5, 0)
_GDIPlus_GraphicsDrawImage($hGrafics1, $hMax, $iWidth - $iwExit -5, 0)
_GDIPlus_GraphicsDrawImage($hGrafics1, $hMin, $iWidth - $iwExit - $iwMax -5, 0)
GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_EVENT_PRIMARYDOWN
_SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
EndSwitch
WEnd
EndFunc
[/autoit] [autoit][/autoit] [autoit]; Grafiken anzeigen
Func MY_WM_PAINT($hWnd, $Msg, $wParam, $lParam)
Global $hGrafics1 = _GDIPlus_GraphicsCreateFromHWND($hGUI)
_GDIPlus_GraphicsDrawImage($hGrafics1, $MainImage, 0, 0)
_GDIPlus_GraphicsDrawImage($hGrafics1, $hExit, $iWidth -5, 0)
_GDIPlus_GraphicsDrawImage($hGrafics1, $hMax, $iWidth - $iwExit -5, 0)
_GDIPlus_GraphicsDrawImage($hGrafics1, $hMin, $iWidth - $iwExit - $iwMax -5, 0)
;~ _WinAPI_RedrawWindow($hGUI, 0, 0, 1)
Return $GUI_RUNDEFMSG
EndFunc
[/autoit] [autoit][/autoit] [autoit]_GDIPlus_Shutdown()
[/autoit] [autoit][/autoit] [autoit][/autoit]Hoffe ihr könnt helfen