📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
ClientHeight = 5100
ClientLeft = 2505
ClientTop = 1590
ClientWidth = 7665
Icon = "Form1.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "Form1.frx":22782
ScaleHeight = 89.959
ScaleMode = 0 'User
ScaleWidth = 135.202
Begin VB.CommandButton Command2
Caption = "重置"
Height = 495
Left = 1680
TabIndex = 6
Top = 4440
Width = 1215
End
Begin VB.Timer Timer2
Interval = 500
Left = 480
Top = 0
End
Begin VB.Timer Timer1
Interval = 300
Left = 0
Top = 0
End
Begin VB.TextBox Text2
BackColor = &H8000000A&
BeginProperty Font
Name = "黑体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 5040
TabIndex = 2
Top = 1560
Width = 1215
End
Begin VB.TextBox Text1
BackColor = &H8000000A&
BeginProperty Font
Name = "黑体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3120
TabIndex = 1
Top = 1560
Width = 1215
End
Begin VB.CommandButton Command1
Cancel = -1 'True
Caption = "开始"
Height = 495
Left = 240
TabIndex = 0
Top = 4440
Width = 1215
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "分"
BeginProperty Font
Name = "宋体"
Size = 26.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000011&
Height = 495
Left = 6360
TabIndex = 5
Top = 1560
Width = 495
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "时"
BeginProperty Font
Name = "宋体"
Size = 26.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000011&
Height = 495
Left = 4440
TabIndex = 4
Top = 1560
Width = 495
End
Begin VB.Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "请设置闹铃时间:"
BeginProperty Font
Name = "宋体"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000C&
Height = 435
Left = 120
TabIndex = 3
Top = 480
Width = 3615
End
Begin VB.Menu a
Caption = "文件"
Visible = 0 'False
WindowList = -1 'True
Begin VB.Menu a1
Caption = "完成"
End
Begin VB.Menu a2
Caption = "重置"
End
Begin VB.Menu aa
Caption = "-"
End
Begin VB.Menu a3
Caption = "退出"
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwflags As Long) As Long
Private Sub a1_Click()
Command1.Enabled = False 'Command1不可用
If Val(Text1) < 1 Or Val(Text1) > 24 Then
MsgBox "小时数输入错误!", vbExclamation, "提示信息"
Text1 = ""
Text1.SetFocus
Command1.Enabled = True
End If
If Val(Text2) < 1 Or Val(Text2) > 60 Then
MsgBox "分钟数输入错误", vbExclamation, "提示信息"
Text2 = ""
Text2.SetFocus
End If
Timer1.Enabled = True '运行Timer1
Form1.Visible = False '隐藏窗体
Form2.Show '运行Form2
End Sub
Private Sub a2_Click()
Command1.Enabled = True 'Command1可用
Text1.Text = "" '清空Text1,Text2
Text2.Text = ""
End Sub
Private Sub a3_Click()
End '结束程序
End Sub
Private Sub Command1_Click()
Command1.Enabled = False 'Command1不可用
If Val(Text1) < 1 Or Val(Text1) > 24 Then
MsgBox "小时数输入错误!", vbExclamation, "提示信息"
Text1 = ""
Text1.SetFocus '输入设置闹铃时间
End If
If Val(Text2) < 1 Or Val(Text2) > 60 Then
MsgBox "分钟数输入错误", vbExclamation, "提示信息"
Text2 = ""
Text2.SetFocus
End If
Timer1.Enabled = True '运行Timer1
Form1.Visible = False '隐藏窗体
Form2.Show '运行Form2
End Sub
Private Sub Command2_Click()
Command1.Enabled = True 'Command1可用
Text1.Text = "" '清空text1,text2
Text2.Text = ""
End Sub
Private Sub Form_Load()
Timer1.Enabled = False 'Timer1不可用 '在窗体标题中显示系统时间
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then '右键弹出菜单
PopupMenu a
End If
End Sub
Private Sub Timer1_Timer()
If Text1 = Hour(Time) Then '设置闹铃和声音
If Text2 = Minute(Time) Then
Form3.Show
Call PlaySound(App.Path + "\铃声.wav", 0&, &H0)
End If
End If
End Sub
Function GetWD(ByVal Week As Integer) As String
Select Case Week
Case 1 '编辑系统星期
GetWD = "日"
Case 2
GetWD = "一"
Case 3
GetWD = "二"
Case 4
GetWD = "三"
Case 5
GetWD = "四"
Case 6
GetWD = "五"
Case 7
GetWD = "六"
End Select
End Function
Private Sub Timer2_Timer()
Me.Caption = Year(Date) & "年" & Month(Date) & "月" & Day(Date) & "日 星期" & GetWD(Weekday(Date)) & " 系统时间" & Format$(Time, "hh:mm:ss") '在窗体标题中显示系统时间
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -