Sign in to follow this  
Followers 0
au3scr

how to add *.png image to gui

2 posts in this topic

$Pic2 = GUICtrlCreatePic(@ScriptDir&"\linux-logo2.jpg", 150, 0, 50, 50) <-- this dont work , But I need to ise this

but

$Pic2 = GUICtrlCreatePic(@ScriptDir&"\linux-logo2.bmp", 150, 0, 50, 50) Works

I need png file cuz Iwant to have picture which background color is transparent.

I want replace this white background with gui color (I have made this background color to transparent color with infarnview) and now i need add *.png file to GUI

Posted Image


Share this post


Link to post
Share on other sites



$Pic2 = GUICtrlCreatePic(@ScriptDir&"\linux-logo2.jpg", 150, 0, 50, 50) <-- this dont work , But I need to ise this

but

$Pic2 = GUICtrlCreatePic(@ScriptDir&"\linux-logo2.bmp", 150, 0, 50, 50) Works

I need png file cuz Iwant to have picture which background color is transparent.

I want replace this white background with gui color (I have made this background color to transparent color with infarnview) and now i need add *.png file to GUI

Posted Image

Thank Paulia for this=)

#include <GDIPlus.au3>
#include <GuiConstantsEx.au3>

Opt("MustDeclareVars", 1)

; ===============================================================================================================================
; Description ...: Shows how to display a PNG image
; Author ........: Paul Campbell (PaulIA)
; Notes .........:
; ===============================================================================================================================

; ===============================================================================================================================
; Global variables
; ===============================================================================================================================
Global $hGUI, $hImage, $hGraphic

; Create GUI
$hGUI = GUICreate("Show PNG", 240, 240)
GUISetState()

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

; Draw PNG image
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
_GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0)

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

; Clean up resources
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_ShutDown()

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