svaneenoo Posted February 11, 2010 Share Posted February 11, 2010 Hi, I want to display a picture on my form. However, the picture is not displayed. I have no clue why. I am a beginning AutIT'er, so apologies...I guess this is a basic question. The picture exists on the indicated loaction. Hope somebody can help me. Thanks in advance for any help an replys Stefaan #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Global $gui, $guiPos, $Pic, $picPos Example1() Func Example1() Local $Pic, $msg GUICreate("My GUI picture", 350, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU) ; will create a dialog box that when displayed is centered GUISetBkColor(0xE0FFFF) $Pic = GUICtrlCreatePic("C:\Documents and Settings\SvanEenoo\Desktop\Paint.NET\Images_Hotspot\mouse2.jpg", 50, 50, 50, 50) GUICtrlSetState($Pic,$GUI_DISABLE) GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd ; resize the control $picPos = GUICtrlSetPos($Pic, 50, 50, 50, 50) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() EndFunc ;==>Example1 Link to comment Share on other sites More sharing options...
Fire Posted February 11, 2010 Share Posted February 11, 2010 Hi svaneenoo,Welcome to AUTOIT Comuunity.Here is your script:#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Local $Pic, $msg, $gui,$guiPos,$picPos Opt('MustDeclareVars', 1) Example1() Func Example1() GUICreate("My GUI picture", 350, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU) ; will create a dialog box that when displayed is centered GUISetBkColor(0xE0FFFF) $Pic = GUICtrlCreatePic("C:\Documents and Settings\SvanEenoo\Desktop\Paint.NET\Images_Hotspot\mouse2.JPG", 50,50) ;make sure extension .jpg or .JPG? GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() EndFunc ;==>Example1 [size="5"] [/size] Link to comment Share on other sites More sharing options...
martin Posted February 11, 2010 Share Posted February 11, 2010 I don't understand what Sh3llC043r's reply is saying, but the suggestion that you need to worry about the case of any letters in a path is incorrect because Windows reads file names without case sensitivity. I don't see what is wrong with your script as far as showing the image is concerned so I think you need to add some extra code to find the problem. Try adding If Not FileExists("C:\Documents and Settings\SvanEenoo\Desktop\Paint.NET\Images_Hotspot\mouse2.jpg") then MsgBox(262144,"Whoops", "No pic") Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
svaneenoo Posted February 12, 2010 Author Share Posted February 12, 2010 Hi, I tried another picture, and it works. I notice that is does not work with transparent .png Is this normal known behaviour? Cheers Link to comment Share on other sites More sharing options...
martin Posted February 12, 2010 Share Posted February 12, 2010 (edited) Hi,I tried another picture, and it works.I notice that is does not work with transparent .pngIs this normal known behaviour?CheersPosting an example which uses a jpg for a problem with using a png is not normal behaviour. Nor, I would like to think, is starting a thread before reading the help. TEDIT: To use a transparent png for a pic use Yashied's Icons.au3 udf in example forums. Edited February 13, 2010 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
zmj2006 Posted February 15, 2010 Share Posted February 15, 2010 Hi, I tried another picture, and it works. I notice that is does not work with transparent .png Is this normal known behaviour? Cheers Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now