Sign in to follow this  
Followers 0
Damein

Pic control not working?

4 posts in this topic

#1 ·  Posted (edited)

For some reason I cannot get this to work:

$CurrentImage = GuiCtrlCreatePic(@ScriptDir & "/Images/Image1.png", 0, 15, 200, 200)

Is it because .png cannot be used? If so, I tried this as well:

(I am downloading the image off a website, and its default is .png)

I changed it using:

InetGet($OverViewImage[1], @ScriptDir & "\Images\Image1.png")

And I can see this image in the folder so I know its downloading. I tried chaing the .png to .jpg and tried using:

$CurrentImage = GuiCtrlCreatePic(@ScriptDir & "/Images/Image1.jpg", 0, 15, 200, 200)

But still no go, I just get a blank GUI.

Edited by Damein

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

According to the help file only BMP, JPG and GIF are supported.

PNG can be used with GDI+. See example 3 in the help file for GUICtrlCreatePic.

BTW: Some error checking will show you if the function does what you want it to do. If $CurrentImage = 0 then there was a problem.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

This does trick with .png images (from help file) :

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#Include <WinAPI.au3>

Opt('MustDeclareVars', 1)

Global $hGUI, $hImage, $hGraphic, $hImage1

$hGUI = GUICreate("Show PNG", 250, 250)

_GDIPlus_StartUp()
$hImage   = _GDIPlus_ImageLoadFromFile(@ScriptDir & "/Images/Image1.png")
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)

GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT")
GUISetState()

do
until GUIGetMsg() = $GUI_EVENT_CLOSE

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

; Draw PNG image
Func MY_WM_PAINT($hWnd, $Msg, $wParam, $lParam)
    _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_UPDATENOW)
    _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0)
    _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_VALIDATE)
    Return $GUI_RUNDEFMSG
EndFunc
Edited by Jayson

Share this post


Link to post
Share on other sites

Thanks Jayson, worked great :unsure:


MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

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