📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
AutoRedraw = -1 'True
Caption = "时钟"
ClientHeight = 3240
ClientLeft = 1800
ClientTop = 1590
ClientWidth = 4050
FillStyle = 0 'Solid
LinkTopic = "Form1"
ScaleHeight = 3240
ScaleWidth = 4050
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 250
Left = 2895
Top = 0
End
Begin VB.CommandButton cmdStart
Caption = "Start"
Height = 300
Left = 0
TabIndex = 0
Top = 2865
Width = 600
End
Begin VB.Line Line1
BorderColor = &H80000001&
BorderWidth = 2
X1 = 15
X2 = 15
Y1 = 120
Y2 = 720
End
Begin VB.Line Line2
BorderColor = &H80000001&
X1 = 135
X2 = 135
Y1 = 120
Y2 = 720
End
Begin VB.Line Line3
BorderColor = &H00C00000&
X1 = 255
X2 = 255
Y1 = 120
Y2 = 720
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public XS
Public YS
Private Function clock(X)
Pi = 3.1415
RAD = Pi / 180
clock = X * RAD
End Function
Private Sub Form_Load()
XS = Form1.Width / 2
YS = (Form1.Height / 2) - 120
Form1.Font.Name = "Courier New"
For AB = 0 To 359 Step 30
A = Sin(clock(AB))
B = -(Cos(clock(AB)))
If AB = 0 Then CNT = 360 Else CNT = AB
TX$ = Trim(Int((CNT) / 30))
Form1.Line ((A * 800) + XS, (B * 800) + YS)-((A * 1000) + XS, (B * 1000) + YS), RGB(0, 0, 0)
Form1.CurrentX = (A * 1200) + XS - (Form1.TextWidth(TX$) / 2)
Form1.CurrentY = (B * 1200) + YS - (Form1.TextHeight(TX$) / 2)
Form1.Print TX$
Next AB
Form1.Line1.X1 = XS
Form1.Line1.Y1 = YS
Form1.Line2.X1 = XS
Form1.Line2.Y1 = YS
Form1.Line3.X1 = XS
Form1.Line3.Y1 = YS
Call Timer1_Timer
End Sub
Private Sub cmdStart_Click()
If Timer1.Enabled = True Then
Timer1.Enabled = False
cmdStart.Caption = "Start"
Else
Timer1.Enabled = True
cmdStart.Caption = "Stop"
End If
End Sub
Private Sub Timer1_Timer()
W = Timer
X = W / 120
Y = W * 6
Z = W / 10
A = Sin(clock(X))
B = -(Cos(clock(X)))
Form1.Line1.X2 = (A * 600) + XS
Form1.Line1.Y2 = (B * 600) + YS
C = Sin(clock(Y))
D = -(Cos(clock(Y)))
Form1.Line3.X2 = (C * 800) + XS
Form1.Line3.Y2 = (D * 800) + YS
E = Sin(clock(Z))
f = -(Cos(clock(Z)))
Form1.Line2.X2 = (E * 800) + XS
Form1.Line2.Y2 = (f * 800) + YS
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -