找回密码
 加入
搜索
楼主: 871224

==Msgbox可以显示倒计时吗?==在线等!

 火.. [复制链接]
发表于 2009-11-27 23:14:31 | 显示全部楼层
回复  kn007


    我看了下,那个是自建的Gui,不是系统的Msgbox(),呵呵~
afan 发表于 2009-11-27 23:12



    呵呵,我知道,一直懒得写,也不会写。。。
想搞来玩玩那
发表于 2009-11-27 23:22:18 | 显示全部楼层
回复 29# kn007

原的没了 只有修改过的

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2009-11-27 23:22:23 | 显示全部楼层
哈哈  不错
发表于 2009-11-27 23:24:07 | 显示全部楼层
回复
asionwu 发表于 2009-11-27 23:22



    若只是汉化,那就没事。。。
发表于 2009-11-27 23:26:31 | 显示全部楼层
回复 34# kn007
汉化和修正了错误
发表于 2009-11-27 23:35:44 | 显示全部楼层
回复  kn007
汉化和修正了错误
asionwu 发表于 2009-11-27 23:26



    修正了什么错误啊?!
发表于 2009-11-28 22:05:28 | 显示全部楼层
好东东,等着发布
发表于 2009-11-29 14:05:11 | 显示全部楼层
哈哈,方法好多
发表于 2009-12-1 02:42:56 | 显示全部楼层
论坛上搜来稍微修改了一下下的,希望对楼主有点帮助:
效果如图所示:


代码如下:
#InClude <ButtonConstants.Au3>
#InClude <GUIConstantsEx.Au3>
#InClude <ProgressConstants.Au3>
#InClude <StaticConstants.Au3>
#InClude <WindowsConstants.Au3>

Global $Config = @TempDir & '\Config.InI'
If FileExists($Config)=False Then IniWrite($Config,'设置','倒计时','60')
Global $Time = IniRead($Config,'设置','倒计时','')
If $Time='' Then $Time=30
;----------------------------------------------------------------------------
$i=$Time
;----------------------------------------------------------------------------
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate('倒计时测试窗口', 350, 172, Default, Default)
$Label1 = GUICtrlCreateLabel($Time & ' 秒后将进入主程序!', 56, 32, 280, 28)
GUICtrlSetFont(-1, 18, 400, 0, '楷体_GB2312')
$Progress1 = GUICtrlCreateProgress(8, 88, 333, 17)
$Button1 = GUICtrlCreateButton('确定(&Y) → 还有 '& $Time & ' 秒', 53, 128, 158, 25, 0)
$Button2 = GUICtrlCreateButton('退出(&X)', 210, 128, 73, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
AdlibRegister('_Time', 1000)
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE, $Button2
                        Exit
                Case $Button1
                        ExitLoop
        EndSwitch
        If $Time <= 0 Then ExitLoop
WEnd
Main()
Exit

Func _Time()
       $Time -= 1
        GUICtrlSetData($Label1, $Time & ' 秒后将进入主程序!')
                GUICtrlCreateButton('确定(&Y) → 还有 '& $Time & ' 秒', 53, 128, 158, 25, 0)
        GUICtrlSetData($Progress1, ($i - $Time) / $i * 100)
        If $Time <= 0 Then AdlibUnRegister('_Time')
EndFunc   ;==>_Time

Func Main()
        Run(@SystemDir&'\NotePad.eXe')
EndFunc   ;==>Main

改动说明:增加了位于系统临时目录的配置文件 Config.ini,从中读取预设值,增设变量 $i=$Time(预定时间值) 可意随意设定倒计时间值,对 GUI 界面作了一点点调整。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2009-12-1 02:52:50 | 显示全部楼层
本帖最后由 ahkang 于 2009-12-1 03:00 编辑

同样也有修改成 UDF 了的,效果如图:


UDF 调用脚本如下:
#InClude "Count_Down.Au3"

$Time=30
$i=$Time
$Caption='倒计时的 UDF 函数测试窗口'
$Font='楷体_GB2312'
;$FontColor=0x008000 ;设置字体为绿色
$FontColor=0xFF0000 ;设置字体为红色
$Program=@WindowsDir&'\NotePad.eXe'

_CountDown()
UDF 文件内容如下(提示:UDF 文件名为“Count_Down.Au3”):
#InClude <ButtonConstants.Au3>
#InClude <GUIConstantsEx.Au3>
#InClude <ProgressConstants.Au3>
#InClude <StaticConstants.Au3>
#InClude <WindowsConstants.Au3>

Global $Time
Global $i
Global $Program
Global $Form1
Global $Label1
Global $Progress1
Global $Button1
Global $Button2
;----------------------------------------------------------------------------
Global $Caption
Global $Font
Global $FontColor
Global $YES='确定(&Y)'
Global $Exit='退出(&X)'
Func _CountDown()
;----------------------------------------------------------------------------
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate($Caption, 350, 172, Default, Default)
$Label1 = GUICtrlCreateLabel($Time & ' 秒后将进入主程序!', 56, 32, 280, 28)
GUICtrlSetFont(-1, 18, 400, 0, $Font)
GUICtrlSetColor(-1, $FontColor)
$Progress1 = GUICtrlCreateProgress(8, 88, 333, 17)
$Button1 = GUICtrlCreateButton($YES&' → 还有 '& $Time & ' 秒', 53, 128, 158, 25, 0)
$Button2 = GUICtrlCreateButton($Exit, 220, 128, 73, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;----------------------------------------------------------------------------
AdlibRegister('_Time', 1000)
;----------------------------------------------------------------------------
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE, $Button2
                        Exit
                Case $Button1
                        ExitLoop
        EndSwitch
        If $Time <= 0 Then ExitLoop
WEnd
Main()
Exit
EndFunc
;----------------------------------------------------------------------------
Func _Time()
                $Time -= 1
                $BtnText=' → 还有 '& $Time & ' 秒'
                $LabText=$Time & ' 秒后将进入主程序!'
        GUICtrlSetData($Label1, $LabText)
                GUICtrlSetData($Button1,$YES&$BtnText)
        GUICtrlSetData($Progress1, ($i - $Time) / $i * 100)
        If $Time <= 0 Then AdlibUnRegister('_Time')
EndFunc   ;==>_Time
;----------------------------------------------------------------------------
Func Main()
        Run($Program)
EndFunc   ;==>Main

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2009-12-1 03:40:18 | 显示全部楼层
回复  menfan1


    已经写成UDF了,能在MsgBox()消息框窗口或标题栏动态显示倒计时,并在倒计时结束时 ...
afan 发表于 2009-11-27 21:24


这样确实可以达到在 MsgBox 对话框中显示倒计时的目的,只不过感觉窗口时间每变化一秒窗口就闪动一次,同时还会发出“咚…咚…”的提示音哩!个人认为还是 GUI 窗口要好些,还可以加进度条显示呢。
发表于 2009-12-1 10:09:51 | 显示全部楼层
回复 41# ahkang


    没有咚咚声(有的话像什么。。。),窗口也不闪。。。
发表于 2009-12-3 15:54:11 | 显示全部楼层
回复 25# menfan1


    已发布了此UDF,请移步:
http://www.autoitx.com/forum.php?mod=viewthread&tid=11196
发表于 2009-12-3 16:11:50 | 显示全部楼层
传送门:http://www.autoitx.com/forum.php?mod=viewthread&tid=11196
afan大哥专门为你开发的udf
发表于 2009-12-3 16:14:49 | 显示全部楼层
http://www.autoitx.com/forum.php?mod=viewthread&tid=11196
金钱交给afan
他专为你开发的一个udf
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-3 07:25 , Processed in 0.083308 second(s), 13 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表