找回密码
 加入
搜索
查看: 1954|回复: 12

[AU3基础] 二个选择按钮加倒计时,请问一下怎么写[已解决]

  [复制链接]
发表于 2016-11-25 20:16:48 | 显示全部楼层 |阅读模式
本帖最后由 13gu 于 2016-11-28 15:04 编辑

二个选择按钮加倒计时,请问一下怎么写
如图

本帖子中包含更多资源

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

×
发表于 2016-11-26 10:12:36 | 显示全部楼层
你先画好框架来
 楼主| 发表于 2016-11-26 10:30:39 | 显示全部楼层
回复 2# cfanpc
就是不会才问呀。。。
发表于 2016-11-27 11:39:11 | 显示全部楼层
本帖最后由 cfanpc 于 2016-11-27 11:47 编辑


基本上可以了,源码很简单,ICO文件你自己去提取


找到128X128的来就可以了
#NoTrayIcon
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $time = 10
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("安全套装选择", 410, 370, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_GROUP))
$Group1 = GUICtrlCreateGroup("", 6, 2, 393, 337)
$Label1 = GUICtrlCreateLabel("温馨提示:系统将在10秒后默认选择360安全套餐", 15, 314, 368, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
$Icon1 = GUICtrlCreateIcon("D:\小工具\2.ico", -1, 50, 80, 128, 128)
$Icon2 = GUICtrlCreateIcon("D:\小工具\1.ico", -1, 233, 79, 128, 128)
$Label2 = GUICtrlCreateLabel("360安全套装", 60, 224, 98, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
$Label3 = GUICtrlCreateLabel("QQ管家安全套装", 229, 222, 126, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

AdlibRegister("_timer", 1000)

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
        If $time <= 0 Then ExitLoop
WEnd

ok()

Func _timer()
        $time -= 1
        GUICtrlSetData($Label1,"温馨提示:系统将在"&$time&"秒后默认选择360安全套餐")
        If $time <= 0 Then AdlibUnRegister()
        
EndFunc   ;==>_timer

Func ok()
        ShellExecute("notepad.exe")
EndFunc

本帖子中包含更多资源

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

×
发表于 2016-11-27 11:48:05 | 显示全部楼层
标签栏建议先写字上去  不然会有一秒的空白  时间和你要的时间一样就可以了
 楼主| 发表于 2016-11-27 19:25:53 | 显示全部楼层
本帖最后由 13gu 于 2016-11-27 21:45 编辑

回复 5# cfanpc
你好,还有一个问题。二个ICO图标好像不能选择?
本来那二个图片分别运行对应的EXE文件,麻烦也写一下?同时也删除ESC退出功能?
谢谢
发表于 2016-11-28 09:07:14 | 显示全部楼层
回复 6# 13gu
#NoTrayIcon
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt("GUICloseOnESC", 0)
Global $time = 30 ;倒计时时间  单位为秒
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("安全套装选择", 410, 370, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_GROUP))
$Group1 = GUICtrlCreateGroup("", 6, 2, 393, 337)
$Label1 = GUICtrlCreateLabel("温馨提示:系统将在30秒后默认选择360安全套餐", 23, 274, 368, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
$Icon1 = GUICtrlCreateIcon("D:\小工具\2.ico", -1, 50, 80, 128, 128)
$Icon2 = GUICtrlCreateIcon("D:\小工具\1.ico", -1, 233, 79, 128, 128)
$Label2 = GUICtrlCreateLabel("360安全套装", 60, 224, 98, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
$Label3 = GUICtrlCreateLabel("QQ管家安全套装", 229, 222, 126, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Progress1 = GUICtrlCreateProgress(16, 304, 369, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

AdlibRegister("_timer", 1000)

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Icon1
                        AdlibUnRegister()
                        ShellExecute("notepad.exe")
                Case $Icon2
                        AdlibUnRegister()
                        ShellExecute("calc.exe")

        EndSwitch
        If $time <= 0 Then ExitLoop
WEnd

ok()

Func _timer()
        $time -= 1
        GUICtrlSetData($Label1,"温馨提示:系统将在"&$time&"秒后默认选择360安全套餐")
        
        GUICtrlSetData($Progress1, (30 - $time) / 0.3)
        If $time <= 0 Then AdlibUnRegister()
        
EndFunc   ;==>_timer

Func ok()
        ShellExecute("notepad.exe")
EndFunc
 楼主| 发表于 2016-11-28 09:24:25 | 显示全部楼层
本帖最后由 13gu 于 2016-11-28 15:03 编辑

回复 7# cfanpc
不好意思是我弄错了,没有问题了
非常感谢!~
 楼主| 发表于 2016-11-28 16:55:58 | 显示全部楼层
回复 7# cfanpc


    你好,还有一个问题,点击图标运行程序后,本身的程序不会退出。麻烦再修改一下?
发表于 2016-11-29 09:49:31 | 显示全部楼层
回复 9# 13gu
运行的下面在加入EXIT就好了  蛋疼  你什么都不会啊
 楼主| 发表于 2016-11-29 11:11:08 | 显示全部楼层
回复 10# cfanpc


    不好意思,程序加了EXIT后
运行时马上打开一个记事本就程序退出了,麻烦再修改一下,谢谢
发表于 2016-11-30 20:06:32 | 显示全部楼层
还可以这样么。。。
发表于 2016-12-7 09:24:33 | 显示全部楼层
難得看到一篇伸手文  我笑了....
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-28 21:26 , Processed in 0.087835 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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