Private Sub Form_Load()
Command1.Caption = "随机画圆"
Command2.Caption = "随机文字"
Command3.Caption = "立体图形"
Command4.Caption = "随机图像"
Command5.Caption = "退出"
Form1.ScaleMode = 1
Picture1.ScaleMode = 1
Picture2.Picture = LoadPicture
("d:\windows\256color.bmp")
End Sub
'随机画圆动画
Private Sub Command1_Click()
Dim XPos, YPos
Picture1.Cls
Do
nn = Int(100 * Rnd)
If nn > 0 Then
Picture1.DrawWidth = nn
End If
XPos = Rnd * Picture1.ScaleWidth
YPos = Rnd * Picture1.ScaleHeight
Picture1.PSet (XPos, YPos), RGB
(Rnd * 256, Rnd * 256, Rnd * 256)
DoEvents
Loop
End Sub
'随机文字动画
Private Sub Command2_Click()
Picture1.Cls
Do
nn = Int(45 * Rnd)
If nn > 0 Then
Picture1.FontSize = nn
End If
Picture1.CurrentX =
Rnd * Picture1.ScaleWidth - 1000
Picture1.CurrentY =
Rnd * Picture1.ScaleHeight
Picture1.ForeColor =
RGB(Rnd * 256, Rnd * 256, Rnd * 256)
Picture1.Print "随机 OK!"
n = n + 1
If n > 50 Then
n = 0
Picture1.BackColor = QBColor(Rnd * 15)
End If
DoEvents
Loop
End Sub
'立体随机动画
Private Sub Command3_Click()
Dim m, n
Picture1.DrawWidth = 1
Picture1.BackColor = RGB(210, 150, 0)
Picture1.Cls
Do
m = Rnd * Picture1.ScaleWidth
n = Rnd * Picture1.ScaleHeight - 500
For i = 0 To Rnd * 800
Picture1.Line(m,n+2.5*i)-(m+i/2,n+2*i),
RGB(180,180,180)
Picture1.Line(m,n+2.5*i)-(m-i/2,n+2*i),
RGB(80,80,80)
Next i
DoEvents
Loop
End Sub
'随机图像显示
Private Sub Command4_Click()
Do
xx = Rnd * Picture1.Width
yy = Rnd * Picture1.Height
Picture1.PaintPicture Picture2.
Picture, xx, yy,
Picture2.Width, Picture2.Height
DoEvents
Loop
End Sub
'退出按钮
Private Sub Command5_Click()
End
End Sub