vistual玫瑰代码
时间: 2023-11-12 22:57:43 浏览: 156
以下是一个简单的 Visual Basic 代码,可以绘制一个玫瑰花的图案:
```
Private Sub Form_Load()
Dim i As Integer
Dim j As Integer
Dim x As Single
Dim y As Single
Dim r As Single
Dim theta As Single
Dim pi As Single
pi = 3.14159265358979
For i = 0 To 360 Step 1
r = Sin(3 * i * pi / 180) * Cos(i * pi / 180) * 200
x = r * Cos(i * pi / 180) + Me.Width / 2
y = r * Sin(i * pi / 180) + Me.Height / 2
Me.PSet (x, y)
Next i
For j = 0 To 360 Step 1
r = Sin(3 * j * pi / 180) * Sin(j * pi / 180) * 200
x = r * Cos(j * pi / 180) + Me.Width / 2
y = r * Sin(j * pi / 180) + Me.Height / 2
Me.PSet (x, y)
Next j
End Sub
```
阅读全文