既然这样一个单张图片的窗体可以,于是想到GIF动画无非是多几帧而已,于是我想用两张图片间隔显现来表现动画效果,代码如下:#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
$mainwindow = GUICreate("GIF动画", 80, 120, 400, 300, BitOR($WS_POPUP,$WS_CLIPSIBLINGS),$WS_EX_LAYERED)
$Label = GUICtrlCreateLabel("标签", 0, 0, 80, 120,$SS_BLACKFRAME,$GUI_WS_EX_PARENTDRAG) ;右键菜单-退出-拖拽
FileInstall("tuzuo.gif", @TempDir & "") ;编译图片
FileInstall("tuyou.gif", @TempDir & "")
$Pic1 = GUICtrlCreatePic(@TempDir & "\tuzuo.gif", 0, 0, 80, 120)
$Pic2 = GUICtrlCreatePic(@TempDir & "\tuyou.gif", 0, 0, 80, 120)
$contextmenu = GUICtrlCreateContextMenu (3); 创建右键主菜单
$infoitem = GUICtrlCreateMenuitem ("退出",$contextmenu) ; 退出
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
exit
Case 0
dongzuo() ;运行动作事件
Case $infoitem ; 退出
infoitem()
EndSwitch
WEnd
Func dongzuo()
While 1
GUICtrlSetState ($Pic1, $GUI_SHOW)
GUICtrlSetState ($Pic2, $GUI_HIDE)
Sleep(500)
GUICtrlSetState ($Pic1, $GUI_HIDE)
GUICtrlSetState ($Pic2, $GUI_SHOW)
Sleep(500)
If $infoitem then ExitLoop ;发生退出事件时停止循环
WEnd
EndFunc
Func infoitem()
FileDelete(@TempDir & "\tuzuo.gif") ;删除图片
FileDelete(@TempDir & "\tuyou.gif")
Exit
EndFunc
但是图片动画会有闪动,请高手帮忙解决!
但是图片动画会有闪动,请高手帮忙解决! |