Tukata Posted January 19, 2010 Share Posted January 19, 2010 Hi I use "GUICtrlCreatePic" and need to replace the image few times and display the original dimension of each image. The help file says: "If you want to have a picture having the same size as the file content just use width=height=0." Whatever I tried I failed. Please help. Another question, Is there a way to use "SplashImageOn" instead and how do I display original dimensions ? And last question: Is there a way to click on the SplashImage to activate the "SplashOff()" ? thank you in advance tukata Link to comment Share on other sites More sharing options...
BrettF Posted January 20, 2010 Share Posted January 20, 2010 Hi there, In response to your first question: #include <GDIPlus.au3> Dim $image[2] $image[0] = @ScriptDir & "\loginbox.jpg" ; http://www.signa5.com/IMG/loginbox/loginbox.jpg 256px × 162px $image[1] = @ScriptDir & "\worldcam.jpg" ; http://www.signa5.com/IMG/worldcam/worldcam.jpg 550px × 413px ;This will download those two images into your script dir. Comment after running it once. ;$return = InetGet ("http://www.signa5.com/IMG/loginbox/loginbox.jpg", @ScriptDir & "\loginbox.jpg", 0) ;If $return > 0 Then ConsoleWrite ("Downloaded Image OK!" & @CRLF) ;$return = InetGet ("http://www.signa5.com/IMG/worldcam/worldcam.jpg", @ScriptDir & "\worldcam.jpg", 0) ;If $return > 0 Then ConsoleWrite ("Downloaded Image OK!" & @CRLF) Global $hGUI = GUICreate ("Test", 800, 600) $hPic = GUICtrlCreatePic ($image[1], 10, 10, 0 ,0) GUISetState () MsgBox (0, "GUI Created!", "Press OK to change image") _ChangeImage ($image[0]) MsgBox (0, "Image Changed!", "Press OK to close") Func _ChangeImage ($sLocation) GUICtrlSetImage ($hPic, $sLocation) _GDIPlus_Startup () $hImage = _GDIPlus_ImageLoadFromFile($sLocation) $width = _GDIPlus_ImageGetWidth($hImage) $height = _GDIPlus_ImageGetHeight($hImage) GUICtrlSetPos ($hPic, 10, 10, $width, $height) _GDIPlus_ImageDispose ($hImage) _GDIPlus_ShutDown () EndFunc You should be able to work out question two from the above example. With question three, just make it yourself... Not too difficult. Probably a few examples scattered around the forums as well. Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Tukata Posted January 20, 2010 Author Share Posted January 20, 2010 BrettF ! Thank you. You have been very helpful. tukata 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