3个回答
2017-06-07
展开全部
'窗体拖入一个按钮、一个计时器
'复制以下代码
Private n As Integer
Private Sub draw()
w = Me.Width
h = Me.Height
Randomize
Dim x As Long
Dim y As Long
Dim r As Long
Dim rgb_r As Integer
Dim rgb_g As Integer
Dim rgb_b As Integer
rgb_r = Int(256 * Rnd)
rgb_g = Int(256 * Rnd)
rgb_b = Int(256 * Rnd)
r = Int(51 * Rnd + 100)
Randomize
x = Int(Rnd() * w)
y = Int(Rnd() * h)
Me.Circle (x, y), r, RGB(rgb_r, rgb_g, rgb_b)
End Sub
Private Sub Command1_Click()
If Me.Command1.Caption = "开始绘图" Then
Me.Cls
n = 0
Me.Timer1.Enabled = True
Me.Command1.Caption = "停止绘图"
Else
n = 0
Me.Timer1.Enabled = False
Me.Command1.Caption = "开始绘图"
End If
End Sub
Private Sub Form_Load()
n = 0
Me.Command1.Caption = "开始绘图"
Me.Timer1.Interval = 100
Me.Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
n = n + 1
If n <= 100 Then
Me.Command1.Caption = "停止绘图"
Call draw
Else
Me.Timer1.Enabled = False
Me.Command1.Caption = "开始绘图"
End If
End Sub
'复制以下代码
Private n As Integer
Private Sub draw()
w = Me.Width
h = Me.Height
Randomize
Dim x As Long
Dim y As Long
Dim r As Long
Dim rgb_r As Integer
Dim rgb_g As Integer
Dim rgb_b As Integer
rgb_r = Int(256 * Rnd)
rgb_g = Int(256 * Rnd)
rgb_b = Int(256 * Rnd)
r = Int(51 * Rnd + 100)
Randomize
x = Int(Rnd() * w)
y = Int(Rnd() * h)
Me.Circle (x, y), r, RGB(rgb_r, rgb_g, rgb_b)
End Sub
Private Sub Command1_Click()
If Me.Command1.Caption = "开始绘图" Then
Me.Cls
n = 0
Me.Timer1.Enabled = True
Me.Command1.Caption = "停止绘图"
Else
n = 0
Me.Timer1.Enabled = False
Me.Command1.Caption = "开始绘图"
End If
End Sub
Private Sub Form_Load()
n = 0
Me.Command1.Caption = "开始绘图"
Me.Timer1.Interval = 100
Me.Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
n = n + 1
If n <= 100 Then
Me.Command1.Caption = "停止绘图"
Call draw
Else
Me.Timer1.Enabled = False
Me.Command1.Caption = "开始绘图"
End If
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
是实心圆还是空心圆呢?
追问
空心的哦
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询