定时器延时.frm
来自「Windows API函数,希望大伙有用哦」· FRM 代码 · 共 70 行
FRM
70 行
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 1000
Left = 1740
Top = 1350
End
Begin VB.CommandButton Command1
Caption = "开 始"
Height = 435
Left = 1680
TabIndex = 0
Top = 2490
Width = 1395
End
Begin VB.Label Label1
AutoSize = -1 'True
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 1590
TabIndex = 1
Top = 1080
Width = 180
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim I As Integer
Private Sub Form_Load()
Me.Caption = "单击命令按钮开始"
End Sub
Private Sub Command1_Click()
Me.Caption = "系统延时 10 秒"
Timer1.Enabled = True
I = 10
Print I
End Sub
Private Sub Timer1_Timer()
I = I - 1
Print I
If I = 1 Then
Timer1.Enabled = False
Me.Caption = "时间到"
Label1 = "时间到 !"
End If
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?