编写一个VB程序在窗体上以鼠标点击处为起点,绘制1000条终点不同的射线
1个回答
2013-06-15
展开全部
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim x1 As Integer, y1 As Integer
For i = 1 To 1000
x1 = Int(2 * Rnd * Me.Width) - Int(Rnd * Me.Width)
y1 = Int(2 * Rnd * Me.Height) - Int(Rnd * Me.Height)
If x1 < 0 Or x1 > Me.Width Or y1 < 0 Or y1 > Me.Height Then
Line (X, Y)-(x1, y1)
Else
i = i - 1
End If
Next i
End Sub
Dim x1 As Integer, y1 As Integer
For i = 1 To 1000
x1 = Int(2 * Rnd * Me.Width) - Int(Rnd * Me.Width)
y1 = Int(2 * Rnd * Me.Height) - Int(Rnd * Me.Height)
If x1 < 0 Or x1 > Me.Width Or y1 < 0 Or y1 > Me.Height Then
Line (X, Y)-(x1, y1)
Else
i = i - 1
End If
Next i
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询