png files in autoit
#1
Posted 14 June 2008 - 04:16 PM
I would try it with GUICtrlCreatePic() and GUICtrlSetImage and so forth. Everytime I would try to use a .png
it would just put a blank space wherever the image was supposed to be.
does autoit support png's?
#2
Posted 14 June 2008 - 04:42 PM
http://www.autoitscript.com/forum/index.ph...7651&hl=png
http://www.autoitscript.com/forum/index.ph...3225&hl=png
#3
Posted 14 June 2008 - 04:55 PM
#include <GDIPlus.au3> #include <WinAPI.au3> _GDIPlus_Startup() $image=_GDIPlus_ImageLoadFromFile("image.png") _GDIPlus_ImageSaveToFile($image,"image.jpg") _WinAPI_DeleteObject($image) GUICreate("test",300,300) GUICtrlCreatePic("image.jpg",10,10) GUISetState() Do $msg=GUIGetMsg() Until $msg=-3 _GDIPlus_Shutdown()
Is the link in my post broken? I do not longer own my domain, all the files are moved to my new domain.Example: http://monoceres.se/test.au3 -> http://andhen.mine.nu/monoceres.se/test.au3
#4
Posted 14 June 2008 - 05:07 PM
My image is very deformed in the gui?...
And it lost ALL of its glossiness, and resolution...
I wanted to use .png in the first place so I could have really good looking images.
Edited by nowagain, 14 June 2008 - 05:09 PM.
#5
Posted 14 June 2008 - 05:21 PM
So it converts it over to a .jpg?
My image is very deformed in the gui?...
And it lost ALL of its glossiness, and resolution...
I wanted to use .png in the first place so I could have really good looking images.
Change to .bmp
Is the link in my post broken? I do not longer own my domain, all the files are moved to my new domain.Example: http://monoceres.se/test.au3 -> http://andhen.mine.nu/monoceres.se/test.au3
#6
Posted 14 June 2008 - 05:29 PM
#include <GDIPlus.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> _GDIPlus_Startup() $image = _GDIPlus_ImageLoadFromFile("image.png") $hwnd = GUICreate("test", 300, 300) GUICtrlCreatePic("", 10, 10, 280, 280) GUISetState() GUIRegisterMsg($WM_PAINT, "_ReDraw") $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd) _GDIPlus_GraphicsDrawImageRect($graphics, $image, 10, 10, 280, 280) Do $msg = GUIGetMsg() Until $msg = -3 _WinAPI_DeleteObject($image) _GDIPlus_GraphicsDispose($graphics) _GDIPlus_Shutdown() Func _ReDraw() _GDIPlus_GraphicsDrawImageRect($graphics, $image, 10, 10, 280, 280) Return $GUI_RUNDEFMSG EndFunc ;==>_ReDraw
Edited by monoceres, 14 June 2008 - 05:29 PM.
Is the link in my post broken? I do not longer own my domain, all the files are moved to my new domain.Example: http://monoceres.se/test.au3 -> http://andhen.mine.nu/monoceres.se/test.au3
#7
Posted 14 June 2008 - 05:35 PM
Thanks a million.
#8
Posted 26 June 2008 - 05:27 AM
When I use this method whenever I move around my window a blackish border expands around my image and stays there. then i minimize it and it goes a way, but then re-appears when i move my window again...?Or you could paint the control yourself
Plain Text#include <GDIPlus.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> _GDIPlus_Startup() $image = _GDIPlus_ImageLoadFromFile("image.png") $hwnd = GUICreate("test", 300, 300) GUICtrlCreatePic("", 10, 10, 280, 280) GUISetState() GUIRegisterMsg($WM_PAINT, "_ReDraw") $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd) _GDIPlus_GraphicsDrawImageRect($graphics, $image, 10, 10, 280, 280) Do $msg = GUIGetMsg() Until $msg = -3 _WinAPI_DeleteObject($image) _GDIPlus_GraphicsDispose($graphics) _GDIPlus_Shutdown() Func _ReDraw() _GDIPlus_GraphicsDrawImageRect($graphics, $image, 10, 10, 280, 280) Return $GUI_RUNDEFMSG EndFunc;==>_ReDraw
#9
Posted 26 June 2008 - 06:47 AM
#include <GDIPlus.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> _GDIPlus_Startup() $image = _GDIPlus_ImageLoadFromFile("glass.png") $hwnd = GUICreate("", 500, 500) GUICtrlCreatePic("", 20, 20, 24, 26) GUISetBkColor(0xeef2fd, $hwnd) GUISetState() GUIRegisterMsg($WM_PAINT, "_ReDraw") $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd) _GDIPlus_GraphicsDrawImageRect($graphics, $image, 20, 20, 24, 26) Do $msg = GUIGetMsg() Until $msg = -3 _WinAPI_DeleteObject($image) _GDIPlus_GraphicsDispose($graphics) _GDIPlus_Shutdown() Func _ReDraw() _GDIPlus_GraphicsDrawImageRect($graphics, $image, 20, 20, 24, 26) Return $GUI_RUNDEFMSG EndFunc;==>_ReDraw
When I run it and move the window containing my .png image a black border forms around it. Is is the re-drawing function? I'm lost and also very new with this GDI+ stuff.
#10
Posted 26 June 2008 - 09:11 PM
#11
Posted 26 June 2008 - 09:20 PM
#include <GDIPlus.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> _GDIPlus_Startup() $image = _GDIPlus_ImageLoadFromFile("glass.png") $hwnd = GUICreate("", 500, 500) GUICtrlCreatePic("", 22, 22, 20, 22); Changed here GUISetBkColor(0xeef2fd, $hwnd) GUISetState() GUIRegisterMsg($WM_PAINT, "_ReDraw") $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd) _GDIPlus_GraphicsDrawImageRect($graphics, $image, 20, 20, 24, 26) Do $msg = GUIGetMsg() Until $msg = -3 _WinAPI_DeleteObject($image) _GDIPlus_GraphicsDispose($graphics) _GDIPlus_Shutdown() Func _ReDraw() _GDIPlus_GraphicsDrawImageRect($graphics, $image, 20, 20, 24, 26) Return $GUI_RUNDEFMSG EndFunc;==>_ReDraw
Is the link in my post broken? I do not longer own my domain, all the files are moved to my new domain.Example: http://monoceres.se/test.au3 -> http://andhen.mine.nu/monoceres.se/test.au3
#12
Posted 27 June 2008 - 10:58 AM
You changed the width and height (24,26) to 20,22. How did that fix it?
#13
Posted 21 February 2009 - 05:02 PM
As far as I can see it looks like its solved, but I don't understand why...
You changed the width and height (24,26) to 20,22. How did that fix it?
Difference by 'GUI Border Width' added, or not.
#14
Posted 22 February 2009 - 03:19 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users





