昨夜长风电影粤语:时钟源代码
来源:百度文库 编辑:中财网 时间:2024/05/01 05:09:47
‘时间:2007年5月6~7号
‘闹铃功能暂无法使用
‘两个窗体,MainForm为程序主窗口,OptionForm为设置闹铃窗口
Const Pi = 3.1415926535897
Private Sub Command1_Click()
‘“设置闹铃”按钮
Load OptionForm
OptionForm.Show
MainForm.Visible = False
End Sub
Private Sub Command2_Click()
‘“退出”按钮
Unload Me
End Sub
Private Sub Form_Load()
‘初始化时间
Timer1.Interval = 500
Label1.Left = 300
Label2.Left = 900
Label3.Left = 1500
Label4.Left = 600
Label5.Left = 1200
Label6.Left = 1800
Label7.Left = Int(Me.ScaleWidth / 2)
Label8.Left = Label7.Left - 1400
Label9.Left = Label7.Left + 1400
Label10.Left = Label7.Left
Label7.Top = 1200
Label8.Top = Label7.Top + 1400
Label9.Top = Label8.Top
Label10.Top = Label9.Top + 1400
MainForm.Scale (-14, 14)-(14, -14)
Label14.Caption = OptionForm.HrTxt.Text
Label15.Caption = OptionForm.MinTxt.Text
If Hour(Time) = Label14.Caption And Minute(Time) = Label15.Caption And Second(Time) = Label16.Caption Then
MsgBox "现在时刻:" & Hour(Time) & "点" & Minute(Time) & "分,您预定的时间到"
End If
End Sub
‘此段代码还存在问题
Private Sub Timer1_Timer()
Label1.Caption = Hour(Time)
Label2.Caption = Minute(Time)
Label3.Caption = Second(Time)
Dim X As Integer
Dim Y As Integer
Dim Sec, Min, Hr As Integer
‘绘制时钟
Sec = Second(Time)
Min = Minute(Time)
Hr = Hour(Time)
MainForm.Cls
MainForm.DrawWidth = 1
X = 9 * Sin(Sec * Pi / 30)
Y = 9 * Cos(Sec * Pi / 30)
MainForm.Line (0, 0)-(X, Y), vbRed
MainForm.DrawWidth = 2
X = 8 * Sin(Min * Pi / 30)
Y = 8 * Cos(Min * Pi / 30)
MainForm.Line (0, 0)-(X, Y), vbGreen
MainForm.DrawWidth = 3
Hr = Hr + Min / 60
X = 7 * Sin(Hr * Pi / 6)
Y = 7 * Cos(Hr * Pi / 6)
MainForm.Line (0, 0)-(X, Y)
End Sub
Private Sub Command1_Click()
‘从此开始为第二个窗口的代码
MainForm.Visible = True
Unload Me
End Sub
Private Sub Form_Load()
HrTxt = GetSetting(App.Title, "Settings1", "hr", "")
MinTxt = GetSetting(App.Title, "Settings2", "min", "")
End Sub
Private Sub Form_Unload(Cancel As Integer)
SaveSetting App.Title, "Settings1", "hr", HrTxt
SaveSetting App.Title, "Settings2", "min", MinTxt
End Sub
Private Sub HrTxt_Change()
MainForm.Label14.Caption = OptionForm.HrTxt.Text
End Sub
Private Sub MinTxt_Change()
MainForm.Label15.Caption = OptionForm.MinTxt.Text
End Sub