Sign in to follow this  
Followers 0
unknown12

PNG Images

6 posts in this topic

Is there anyway to use PNG files with transparency in the GUI?

I can't seem to do it. When I create a new 'pic' with the source as a png it just displays blank.

Cheers.

Share this post


Link to post
Share on other sites



#4 ·  Posted (edited)

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 :rolleyes: ).

Edited by unknown12

Share this post


Link to post
Share on other sites

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 :rolleyes: ).

This is from the Yahoo AutoIt Group, posted by valery_vi http://tech.groups.yahoo.com/group/AutoItList/message/31198

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

Share this post


Link to post
Share on other sites

Yeah but the trick is posting 2 png files that throws everything out of wak


[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0