📄 vbnaozhong.txt
字号:
Option Explicit Dim AlarmTime '申明变量 --------- Private Sub Command1_Click() Call dialog '调用dialog子程序 End Sub -------- Private Sub Command2_Click() AlarmTime = InputBox(“请输入你想设定的时间,例如(19:12:00), “小闹钟) If AlarmTime = “ Then Exit Sub If Not IsDate(AlarmTime) Then MsgBox “你所输入的不是时间格式,请重试!, ,“Wrong Else AlarmTime = CDate(AlarmTime) End If '判断输入的是否可转换成time格式 'isdate函数是判断输入的是否可转换成date格式 End Sub -------------- Private Sub Command3_Click() Call deng '调用deng子程序 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 else caption=“小闹钟 End If '如果窗口被最小化,则调用mintime程序 End Sub --------------- Private Sub mintime() Caption = Format(Time, “long Time) '使用长时间格式来显示时间 End Sub --------------- Private Sub Timer1_Timer() If lblTime.Caption <> CStr(Time) Then lblTime.Caption = Time End If '显示时间每秒钟的变化 If Time >= AlarmTime Then Call deng End If '判断如果现在的时间超过了设定的时间,则调用deng子程序 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 If Label1 <> “ Then Command3.Enabled = -1 Else Exit Sub End If '把打开的文件名给于label1 '如果label1不为空时,则command3即可用 End Sub -------------- Sub deng() Dim ss ss = Shell(Label1.Caption, 1) End '启动指定的文件,并且结束小闹钟程序 End Sub 最后在about对话框中要提的是:在form_load中app.title表示你的应用程序的名字;app.major、minor、revision是关于应用程序的版本信息;lblDescription.Caption 用于对本程序的一些说明描述之类的话;lblDisclaimer.Caption用于版权信息或警告等。
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -