📄 time.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3900
ClientLeft = 60
ClientTop = 345
ClientWidth = 5790
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3900
ScaleWidth = 5790
StartUpPosition = 2 '屏幕中心
Begin VB.Timer Timer1
Interval = 500
Left = 1560
Top = 3000
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 2160
Top = 3000
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton Command1
Caption = "预设文件"
Height = 495
Left = 240
TabIndex = 7
Top = 360
Width = 1215
End
Begin VB.CommandButton Command4
Caption = "退出"
Height = 495
Left = 240
TabIndex = 2
Top = 3000
Width = 1215
End
Begin VB.CommandButton Command3
Caption = "即时启动"
Height = 495
Left = 240
TabIndex = 1
Top = 2120
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "设定时间"
Height = 495
Left = 240
TabIndex = 0
Top = 1240
Width = 1215
End
Begin VB.Label Label1
Height = 375
Left = 1560
TabIndex = 6
Top = 420
Width = 3615
End
Begin VB.Label Label4
Height = 375
Left = 3840
TabIndex = 5
Top = 1300
Width = 1215
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "当前时间:"
Height = 180
Left = 2880
TabIndex = 4
Top = 1397
Width = 900
End
Begin VB.Label Label2
Height = 375
Left = 1560
TabIndex = 3
Top = 1300
Width = 1215
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 AlarmTime
Private Sub Command1_Click()
'调用dialog子程序
Call dialog
End Sub
Private Sub Command2_Click()
AlarmTime = InputBox("请输入你想设定的时间,例如(19:12:00)", "小闹钟")
If AlarmTime = "" Then
Exit Sub
End If
'isdate函数是判断输入的是否可转换成date格式
If Not IsDate(AlarmTime) Then
MsgBox "你所输入的不是时间格式,请重试!", , "Wrong"
Else
AlarmTime = CDate(AlarmTime)
End If
End Sub
Private Sub Command3_Click()
'调用deng子程序
Call deng
End Sub
Private Sub Command4_Click()
End
End Sub
Private Sub Form_Click()
frmAbout.Show '显示关于对话框
End Sub
Private Sub Form_Load()
Command3.Enabled = 0
AlarmTime = "" '初始化时command3为不可用的
End Sub
Private Sub Form_Resize()
If WindowState = 1 Then
mintime '如果窗口被最小化,则调用mintime程序
Else
Caption = "小闹钟"
End If
End Sub
Sub mintime()
Caption = Format(Time, "long Time") / 使用长时间格式来显示时间
End Sub
Private Sub Timer1_Timer()
If Label2.Caption <> CStr(Time) Then
Label2.Caption = AlarmTime
Label3.Caption = Time '显示时间每秒钟的变化
End If
If Time >= AlarmTime Then
Call deng '判断如果现在的时间超过了设定的时间,则调用deng子程序
End If
If WindowState = 1 Then
If Minute(CDate(Caption)) <> Minute(Time) Then
mintime '最小化时显示时间每分钟的变化
End If
End If
End Sub
Sub dialog()
CommonDialog1.Flags = cdlCFBoth
CommonDialog1.ShowOpen
Label1.Caption = CommonDialog1.FileName ' 把打开的文件名给于label1
If Label1 <> "" Then
Command3.Enabled = -1 '如果label1不为空时,则command3即可用
Else
Exit Sub
End If
End Sub
Sub deng()
Dim ss
ss = Shell(Label1.Caption, 1) '启动指定的文件,并且结束小闹钟程序
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -