Private Sub Form_Load()
With picView
.BackColor = vbWhite
.ForeColor = vbBlack
End With
With picTmp
.BackColor = vbWhite
.ForeColor = vbBlack
End With
m_lngCurLeft = -1
picTmp.Tag = 0
End Sub
Private Sub Form_Resize()
Dim i As Integer
For i = 0 To 6
Label1(i).Caption = Format(Time + #12:01:00 AM# * i, "hh:mm")
Next
With picView
.Width = ScaleWidth - 4500
.Height = ScaleHeight - 5000
picTmp.Width = .Width
picTmp.Height = .Height
End With
cmdOK.Move ScaleWidth - 4000, ScaleHeight - 600
Label1(0).Move ScaleWidth - 13200, ScaleHeight - 3800
Label1(1).Move ScaleWidth - 11400, ScaleHeight - 3800
Label1(2).Move ScaleWidth - 9600, ScaleHeight - 3800
Label1(3).Move ScaleWidth - 7800, ScaleHeight - 3800
Label1(4).Move ScaleWidth - 6000, ScaleHeight - 3800
Label1(5).Move ScaleWidth - 4200, ScaleHeight - 3800
Label1(6).Move ScaleWidth - 2400, ScaleHeight - 3800
DrawGridBack
End Sub
Private Sub DrawBack()
Dim lngY As Long, i As Long
Dim lngWidth As Long, lngHeight As Long
With picTmp
.DrawStyle = 2
lngWidth = .ScaleWidth
lngHeight = .ScaleHeight
If m_bolFlag Then
BitBlt .hDC, 0, 0, picView.Width - 2, picView.Height, .hDC, 2, 0, SRCCOPY
.ForeColor = vbBlack
For i = m_lngCurLeft To lngWidth - 10 Step LNG_STEP2
Next
picTmp.Tag = CLng(picTmp.Tag) + 1
If CLng(picTmp.Tag) >= 10 Then picTmp.Tag = "4"
If CLng(picTmp.Tag) >= 3 Then
picTmp.Line (i - LNG_STEP2, 0)-(i - LNG_STEP2, lngHeight)
End If
End If
.DrawStyle = 6
.ForeColor = vbBlack
Randomize Second(Time)
lngY = Int(((lngHeight - 40) * Rnd) + lngHeight / 30)
picTmp.Line (m_lngX - 2, m_lngOldY)-(m_lngX - 1, lngY)
m_lngOldY = lngY
picView.Picture = .Image
End With
End Sub
Private Sub DrawGridBack()
Dim i As Long
Dim lngWidth As Long, lngHeight As Long
picTmp.DrawStyle = 2
With picTmp
lngWidth = .ScaleWidth
lngHeight = .ScaleHeight
'画竖线
For i = m_lngCurLeft To lngWidth - 2 Step LNG_STEP2
picTmp.Line (i, 0)-(i, lngHeight)
Next
picTmp.DrawStyle = 6
'画横线
For i = -1 To lngHeight Step LNG_STEP1
picTmp.Line (0, i)-(lngWidth, i)
Next
End With
End Sub
Private Sub Timer1_Timer()
If m_bolFlag Then m_lngCurLeft = m_lngCurLeft - 2
If m_lngCurLeft = -LNG_STEP2 * 2 Then m_lngCurLeft = -1
DrawBack
m_lngX = m_lngX + 2
If m_lngX >= picView.ScaleWidth - 2 Then
m_bolFlag = True
m_lngX = picView.ScaleWidth - 2
End If
End Sub