7,785
社区成员




VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5715
ClientLeft = 60
ClientTop = 450
ClientWidth = 8415
LinkTopic = "Form1"
ScaleHeight = 381
ScaleMode = 3 'Pixel
ScaleWidth = 561
StartUpPosition = 3 'Windows Default
Begin VB.PictureBox Picture1
AutoRedraw = -1 'True
BorderStyle = 0 'None
Height = 4680
Left = 90
ScaleHeight = 312
ScaleMode = 3 'Pixel
ScaleWidth = 539
TabIndex = 0
Top = 75
Width = 8085
End
Begin VB.Timer Timer1
Interval = 100
Left = 330
Top = 4980
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Const SRCCOPY = &HCC0020
Dim l As Long
Dim oldy As Long
Dim newy As Long
Private Sub Form_Load()
l = 0
Picture1.Width = 400
oldy = Picture1.Height / 3
newy = Picture1.Height / 3
End Sub
Private Sub Timer1_Timer()
Randomize Timer
newy = Picture1.Height / 3 + 100 * Rnd
If l + 20 < Picture1.Width Then
Picture1.Line (l, oldy)-(l + 20, newy)
l = l + 20
Else
BitBlt Picture1.hDC, 0, 0, Picture1.Width - 20, Picture1.Height, Picture1.hDC, 20, 0, SRCCOPY
Picture1.Line (l - 20, oldy)-(l - 1, newy)
Picture1.Refresh
End If
oldy = newy
End Sub