新建From1(窗体),新建Command1(按钮CommandButton),代码:
Private Sub Command1_Click()
Dim Color As Integer, Xpos As Integer, Ypos As Integer, Counter As Integer
Me.DrawWidth = 4
Do
Xpos = Rnd * Me.ScaleWidth
Ypos = Rnd * Me.ScaleHeight
Color = Rnd * 15
PSet (Xpos, Ypos), QBColor(Color)
Counter = Counter + 1
Loop Until Counter >= 1000
End Sub
可以不断点击。