Jump to content
Sign in to follow this  
cristii88bic

Images on GUI

Recommended Posts

cristii88bic

Hello! I want to know if it's possible to use pictures on on GUI without using 'SplashImageON/OFF' or a buton (what i'm trying to say is that i use buttons and combine the original style with '$bs_bitma'p using 'BitOR' and then 'guictrlsetimage'). I' currently trying to make (for example) a picture starting from the center of the GUI to increse(or move in the GUI) and for that I used buttons with images, but because i delete the buttons and then create new ones the increasing (or moving) effect doesn't seem real because it's flashing. So I tried using 'avi'. In this instance the effect works great because it's made in macromedia flash but it's hard work to make this effects. So I'm asking for your help. Please excuse my english language (i don't know it very well and it's my first post here). Thank you.

Share this post


Link to post
Share on other sites
cristii88bic

OK! I've discovered myself. With 'GuiCtrlCreatePic'. :)

Share this post


Link to post
Share on other sites
picea892

I think you will find the same limitation with guictrlcreatepic. Creating and destroying will cause it to blink.

I have a bit better results using controlmove ... but even still.

Share this post


Link to post
Share on other sites
GEOSoft

Do you mean something like this?

#include <WindowsConstants.au3>

Global $iGw = 410, $iGh = 350, $bChng = True, $iDel = 600
$Frm_Main = GUICreate("My Test Form", $iGw,$iGh)
Global $aImage[2] = [@ScriptDir & "\Sunrise_ProtIsl.jpg", @ScriptDir & "\Sunrise.jpg"]
GUISetState()
$Frm_sImage = GUICreate("image", $iGw, $iGh, 0, 0, $WS_CHILD, -1, $Frm_Main)
$aClientSz = WinGetClientSize($Frm_sImage)
$hPic = GUICtrlCreatePic("", 0, 0, $aClientSz[0], $aClientSz[1])
GUICtrlSetImage($hPic, $aImage[0])
GUISetState()
$iTimer = TimerInit()
While 1
    $Msg = GUIGetMsg()

    If TimerDiff($iTimer) >= 3000 Then _ImgChng()
    Switch $Msg
        Case -3
            Exit
    EndSwitch
WEnd

Func _ImgChng()
    $bChng = NOT $bChng
    If NOT $bChng Then
        _Win_xPlode($Frm_sImage, 5, $iDel)
        GUICtrlSetImage($hPic, $aImage[1])
        _Win_xPlode($Frm_sImage, 4, $iDel)
    Else
        _Win_xPlode($Frm_sImage, 5, $iDel)
        GUICtrlSetImage($hPic, $aImage[0])
        _Win_xPlode($Frm_sImage, 4, $iDel)
    EndIf
    $iTimer = TimerInit()
EndFunc

Func _Win_xPlode($hWnd, $iType = 4, $tDel = 600)
  If Not StringInStr("45", $iType) Then $pType = 4
  Local $btype = "0x000" & $iType & "0010"
  DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hWnd, "int", $tDel, "long", $btype)
    If $iType = 4 Then
      GUISetState(@SW_SHOW, $hWnd)
    Else
      GUISetState(@SW_Hide, $hWnd)
    EndIf
EndFunc   ;==>_Win_Plode

Edit: Hang on a minute. You need the images and I want to make a small code change.

Edit 2:

Good to go. Images (attached) must be extracted to the script dir. This does an image change every 3 seconds and it's just a demo of how to handle your own code.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
picea892

Very nice use of the winanimate dllcall. I hadn't thought to use it that way before

sometimes these simple touches make all the difference. I appreciate you sharing

Share this post


Link to post
Share on other sites
GEOSoft

Very nice use of the winanimate dllcall. I hadn't thought to use it that way before

sometimes these simple touches make all the difference. I appreciate you sharing

I actually wrote a slideshow like that using all the winanimate calls for a script which was my wifes electronic birthday card. using all card images and a label at the bottom that was set using random sayings from an array.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
cristii88bic

I thank you all, especially GeoSoft!

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  

×