VB中怎样用星号画一个圆
来源:学生作业帮 编辑:搜搜考试网作业帮 分类:综合作业 时间:2024/07/15 06:51:01
VB中怎样用星号画一个圆
![VB中怎样用星号画一个圆](/uploads/image/z/6820757-53-7.jpg?t=VB%E4%B8%AD%E6%80%8E%E6%A0%B7%E7%94%A8%E6%98%9F%E5%8F%B7%E7%94%BB%E4%B8%80%E4%B8%AA%E5%9C%86)
Option Explicit
Private Sub Command1_Click()
Dim CenterX As Single, CenterY As Single
Dim R As Integer, X As Single, Y As Single, i As Integer
Const pi = 3.1415926
Randomize
R = 2000
CenterX = Me.ScaleWidth / 2: CenterY = Me.ScaleHeight / 2
For i = 0 To 355 Step 5
X = CenterX + R * Cos(i * pi / 180)
Y = CenterY - R * Sin(i * pi / 180)
Me.ForeColor = QBColor(Int(Rnd() * 15))
Me.CurrentX = X: Me.CurrentY = Y
Me.Print "*"
Next
End Sub![](http://img.wesiedu.com/upload/5/da/5da74db00d7c673d1082f20bc34e7f02.jpg)
Private Sub Command1_Click()
Dim CenterX As Single, CenterY As Single
Dim R As Integer, X As Single, Y As Single, i As Integer
Const pi = 3.1415926
Randomize
R = 2000
CenterX = Me.ScaleWidth / 2: CenterY = Me.ScaleHeight / 2
For i = 0 To 355 Step 5
X = CenterX + R * Cos(i * pi / 180)
Y = CenterY - R * Sin(i * pi / 180)
Me.ForeColor = QBColor(Int(Rnd() * 15))
Me.CurrentX = X: Me.CurrentY = Y
Me.Print "*"
Next
End Sub
![](http://img.wesiedu.com/upload/5/da/5da74db00d7c673d1082f20bc34e7f02.jpg)