7,785
社区成员




Option Explicit
Const v As Integer = 500
Private Sub Form_Load()
Dim i As Integer
With Me
.Width = 7100
.Height = 5300
.ScaleMode = 1
.AutoRedraw = True
.DrawWidth = 2
'坐标
Scale (-v, .ScaleHeight)-(.ScaleWidth, -3 * v) '重画坐标
Line (0, 0)-(.ScaleWidth, 0), &H0& 'X
Line (-10, 0)-(0, -.ScaleHeight), &H0& 'Y
'时间刻度(Y)
For i = 1 To 14
Line (i * v, 50)-(i * v, -0), &H0&
Next
'距离刻度(Y)
For i = 1 To 10
Line (0, i * v)-(50, i * v), &H0&
Next
Timer1.Enabled = True
Timer1.Interval = 1000
Randomize
.DrawWidth = 2
End With
End Sub
Private Sub Timer1_Timer()
Dim i As Single
Dim r As Integer
Dim Color As Long
Dim k As Integer
Static cnt As Integer
Color = RGB(CInt(Rnd * 255) + 1, CInt(Rnd * 255) + 1, CInt(Rnd * 255) + 1)
r = Int(Rnd * 8) + 1
k = 50
Do While k < r * v
DoEvents
Line (cnt * v, k)-((cnt + 1) * v, k), Color
k = k + 10
Loop
cnt = cnt + 1
If cnt = 13 Then Timer1.Enabled = False
End Sub