Re: PNG Images

"valery_vi" <[email protected]>
Newsgroups gmane.comp.windows.autoit.user
Message-ID <[email protected]>
Hi,

Someone from AutoItScript forum asked:
http://www.autoitscript.com/forum/index.php?showtopic=48457
"
I've found lod3n's script, but that is using a PNG for the entire 
GUI. I'm looking to do it for one control (As you can see, i'm a 
noob  ). 
"

This script shows Torus.png (from Auto3Lib) inside Pic control:

#include <A3LGDIPlus.au3>
Global $hGUI, $Pic, $hPic, $hImage, $hGraphic

; Create GUI
$hGUI = GUICreate("Show PNG", 400, 400)
$Label = GUICtrlCreateLabel('Auto3Lib shows PNG file', 130, 20, 150, 
20)

_GDIP_StartUp()

GUISetState()

$Pic = GUICtrlCreatePic('',80,80, 240, 240)
$hPic = ControlGetHandle("Show PNG", "", "Static2")

; Load PNG image
$hImage   = _GDIP_ImageLoadFromFile(@ScriptDir & "\Torus.png")

; Draw PNG image
$hGraphic = _GDIP_GraphicsCreateFromHWND($hPic)
_GDIP_GraphicsDrawImage($hGraphic, $hImage, 0, 0)

; Loop until user exits
do
until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIP_GraphicsDispose($hGraphic)
_GDIP_ImageDispose($hImage)
_GDIP_ShutDown()

This method was used in ALS script (see above messages), too.

Valery
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.