LithiumLi Posted January 23, 2009 Share Posted January 23, 2009 (edited) Hello How would I go about making a GIF effect using jpg's in my GUI, my method isn't working so well and the odd time it flashes and how can I update my GIF effect without using sleep. I know I could be using a real GIF but I want to try and avoid that, I even had to make my own Update function since for some reason GUICtrlSetImage refuses to update my picture control. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Includes = @ScriptDir & "\Test\" $CenL = 0 $CenT = 0 $Nary = GUICreate("Form1", 500, 500) $Rc = GUICtrlCreatePic($Includes & "Rc_0.jpg", $CenL , $CenT, 280 , 127) $Ox = GUICtrlCreatePic($Includes & "Ox_0.jpg", $CenL + 15, $CenT + 18, 64, 94) $Ox = GUICtrlCreatePic($Test , $CenL + 15, $CenT + 18, 64, 94) GUISetState(@SW_SHOW) $i = 0 While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch If $i = 9 Then $i = 1 Sleep(500) _UpdateImageControl($Ox , $Includes & "Ox_" & $i & ".jpg" , $CenL + 15, $CenT + 18 , 64 , 94) $i = $i +1 WEnd Func _UpdateImageControl($Control , $ImageSource , $ImageX , $ImageY , $ImageWidth , $ImageHeight) GUICtrlDelete($Control) GUICtrlCreatePic($ImageSource , $ImageX , $ImageY , $ImageWidth , $ImageHeight) EndFunc Edited January 23, 2009 by LithiumLi Link to comment Share on other sites More sharing options...
Manjish Posted January 23, 2009 Share Posted January 23, 2009 ya.. the screen flashes once with the image and vanishes.. What kind of gif effect do u want? i mean i didn't understand. AutoIT help file clearly mentions, that it doesn't suppport animated gif.. [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com Link to comment Share on other sites More sharing options...
LithiumLi Posted January 23, 2009 Author Share Posted January 23, 2009 (edited) AutoIT help file clearly mentions, that it doesn't suppport animated gif.. I know the Autoit help file says it doesn't support animated GIF's but that doesn't mean it's impossible, I would just use _IECreateEmbedded() which could display a animated GIF but thats not what I want. ya.. the screen flashes once with the image and vanishes.. I was kind of hoping I could get rid of that problem or even mask it, I was sort of hoping there was a way to not delete the control until the other image has taken effect. What kind of gif effect do u want? I want a GUI effect that doesn't flicker and may be a better coding style than the one I chose to make. expandcollapse popup#cs I Think I got an idea could this possibly work, right now I am going to school so I cant test it but what if I had a control behind another control and the one that overlaps the back control is the first part of the so called GIF and when I want to change it Deletes/Hides the first layer. Hopefully it works. #CE #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("Idea", 250 , 250) $Pic1 = GUICtrlCreatePic("GIF_2.jpg", 0, 0, 250, 250) $Pic2 = GUICtrlCreatePic("GIF_1.jpg", 0, 0, 250, 250) ;If I am correct $Pic2 will be overlapping $Pic1 ;GUICtrlDelete($Pic2) If I do this I would have to keep recreating another control so...No! ;GUICtrlSetState($Pic2 , $GUI_HIDE) May be this command will serve more of a purpose GUISetState(@SW_SHOW) $Pic = 1 While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch _HideShow($Pic) WEnd Func _HideShow($Switch) If $Pic = 1 Then $Pic = 2 GUICtrlSetState($Pic1 , $GUI_SHOW) GUICtrlSetState($Pic2 , $GUI_HIDE) ElseIf $Pic = 2 $Pic = 1 GUICtrlSetState($Pic2 , $GUI_SHOW) GUICtrlSetState($Pic1 , $GUI_HIDE) Else Exit EndIf EndFunc Edited January 23, 2009 by LithiumLi Link to comment Share on other sites More sharing options...
trancexx Posted January 23, 2009 Share Posted January 23, 2009 I know the Autoit help file says it doesn't support animated GIF's but that doesn't mean it's impossible, I would just use _IECreateEmbedded() which could display a animated GIF but thats not what I want. ya.. the screen flashes once with the image and vanishes.. I was kind of hoping I could get rid of that problem or even mask it, I was sort of hoping there was a way to not delete the control until the other image has taken effect. What kind of gif effect do u want? I want a GUI effect that doesn't flicker and may be a better coding style than the one I chose to make. expandcollapse popup#cs I Think I got an idea could this possibly work, right now I am going to school so I cant test it but what if I had a control behind another control and the one that overlaps the back control is the first part of the so called GIF and when I want to change it Deletes/Hides the first layer. Hopefully it works. #CE #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("Idea", 250 , 250) $Pic1 = GUICtrlCreatePic("GIF_2.jpg", 0, 0, 250, 250) $Pic2 = GUICtrlCreatePic("GIF_1.jpg", 0, 0, 250, 250) ;If I am correct $Pic2 will be overlapping $Pic1 ;GUICtrlDelete($Pic2) If I do this I would have to keep recreating another control so...No! ;GUICtrlSetState($Pic2 , $GUI_HIDE) May be this command will serve more of a purpose GUISetState(@SW_SHOW) $Pic = 1 While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch _HideShow($Pic) WEnd Func _HideShow($Switch) If $Pic = 1 Then $Pic = 2 GUICtrlSetState($Pic1 , $GUI_SHOW) GUICtrlSetState($Pic2 , $GUI_HIDE) ElseIf $Pic = 2 $Pic = 1 GUICtrlSetState($Pic2 , $GUI_SHOW) GUICtrlSetState($Pic1 , $GUI_HIDE) Else Exit EndIf EndFuncIf I were you I would do it like this: GUICreate("", 250, 250) $BMP1 = "GIF_2.jpg" $BMP2 = "GIF_1.jpg" $Pic = GUICtrlCreatePic("", 0, 0, 250, 250) GUISetState(@SW_SHOW) $timer = TimerInit() $x = 0 While 1 If GUIGetMsg() = -3 Then Exit _HideShow() WEnd Func _HideShow() If Mod(Floor(TimerDiff($timer) / 200), 2) Then If $x = 1 Then GUICtrlSetImage($Pic, $BMP1) $x = 0 EndIf Else If Not $x Then GUICtrlSetImage($Pic, $BMP2) $x = 1 EndIf EndIf EndFunc But, I'm not. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
KaFu Posted January 23, 2009 Share Posted January 23, 2009 Or try this UDF, it's utilizing an embedded IE...http://www.autoitscript.com/forum/index.ph...mp;#entry251468 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
LithiumLi Posted January 23, 2009 Author Share Posted January 23, 2009 thanks, ill try it when I get home 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