VB中怎样用星号画一个圆

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/15 02:50:37

VB中怎样用星号画一个圆
VB中怎样用星号画一个圆

VB中怎样用星号画一个圆
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