Post by Holle » 11 Feb 2014, 07:56
Wenn ich Icons in eine Gui lade dann kann ich mit "w" und "h" die breite und höhe bestimmen.
Wenn ich das gleiche nun per Gdip mache weicht die Größe jedoch ab, warum?
Hier ist ein Beispiel-Script:
Code: Select all
#SingleInstance
; #include GDIP.ahk ;remove comment, if GDIP is not in the standard library
if !FileExist("Clipboard.png")
URLDownloadToFile, http://der-holle.de/ahk/Clipboard.png, Clipboard.png
if !FileExist("Save.png")
URLDownloadToFile, http://der-holle.de/ahk/Save.png, Save.png
if !FileExist("Print.png")
URLDownloadToFile, http://der-holle.de/ahk/Print.png, Print.png
if !FileExist("Close.png")
URLDownloadToFile, http://der-holle.de/ahk/Close.png, Close.png
OnExit, Exit
pToken := Gdip_Startup()
Gui, Add, GroupBox, x10 y10 w220 h70, From PNG
Gui, Add, Picture, x20 y30 w40 h40, Clipboard.png
Gui, Add, Picture, x+10 w40 h40, Save.png
Gui, Add, Picture, x+10 w40 h40, Print.png
Gui, Add, Picture, x+15 w40 h40, Close.png
Gui, Add, GroupBox, x10 y100 w220 h70, From Gdip
Gui, Add, Picture, x20 y120 w40 h40 hwndhClipboard 0xE
Gui, Add, Picture, x+10 w40 h40 hwndhSave 0xE
Gui, Add, Picture, x+10 w40 h40 hwndhPrint 0xE
Gui, Add, Picture, x+15 w40 h40 hwndhClose 0xE
Gui, Show
pBitmap := Gdip_CreateBitmapFromFile("Clipboard.png")
hBitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
SetImage(hClipboard, hBitmap)
pBitmap := Gdip_CreateBitmapFromFile("Save.png")
hBitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
SetImage(hSave, hBitmap)
pBitmap := Gdip_CreateBitmapFromFile("Print.png")
hBitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
SetImage(hPrint, hBitmap)
pBitmap := Gdip_CreateBitmapFromFile("Close.png")
hBitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
SetImage(hClose, hBitmap)
return
ESC::
Exit:
Gdip_DisposeImage(pBitmap)
DeleteObject(hBitmap)
Gdip_Shutdown(pToken)
ExitApp
Wenn ich Icons in eine Gui lade dann kann ich mit "w" und "h" die breite und höhe bestimmen.
Wenn ich das gleiche nun per Gdip mache weicht die Größe jedoch ab, warum?
Hier ist ein Beispiel-Script:
[code=autohotkey file=Script.ahk]#SingleInstance
; #include GDIP.ahk ;remove comment, if GDIP is not in the standard library
if !FileExist("Clipboard.png")
URLDownloadToFile, http://der-holle.de/ahk/Clipboard.png, Clipboard.png
if !FileExist("Save.png")
URLDownloadToFile, http://der-holle.de/ahk/Save.png, Save.png
if !FileExist("Print.png")
URLDownloadToFile, http://der-holle.de/ahk/Print.png, Print.png
if !FileExist("Close.png")
URLDownloadToFile, http://der-holle.de/ahk/Close.png, Close.png
OnExit, Exit
pToken := Gdip_Startup()
Gui, Add, GroupBox, x10 y10 w220 h70, From PNG
Gui, Add, Picture, x20 y30 w40 h40, Clipboard.png
Gui, Add, Picture, x+10 w40 h40, Save.png
Gui, Add, Picture, x+10 w40 h40, Print.png
Gui, Add, Picture, x+15 w40 h40, Close.png
Gui, Add, GroupBox, x10 y100 w220 h70, From Gdip
Gui, Add, Picture, x20 y120 w40 h40 hwndhClipboard 0xE
Gui, Add, Picture, x+10 w40 h40 hwndhSave 0xE
Gui, Add, Picture, x+10 w40 h40 hwndhPrint 0xE
Gui, Add, Picture, x+15 w40 h40 hwndhClose 0xE
Gui, Show
pBitmap := Gdip_CreateBitmapFromFile("Clipboard.png")
hBitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
SetImage(hClipboard, hBitmap)
pBitmap := Gdip_CreateBitmapFromFile("Save.png")
hBitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
SetImage(hSave, hBitmap)
pBitmap := Gdip_CreateBitmapFromFile("Print.png")
hBitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
SetImage(hPrint, hBitmap)
pBitmap := Gdip_CreateBitmapFromFile("Close.png")
hBitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
SetImage(hClose, hBitmap)
return
ESC::
Exit:
Gdip_DisposeImage(pBitmap)
DeleteObject(hBitmap)
Gdip_Shutdown(pToken)
ExitApp[/code]