Option Explicit
Const STEP_PAI As Double = 0.0031415926535
Dim xisu As Double
Private Sub drawPoint(Optional ByVal lngColor As Long = vbBlue)
Cls
Dim i As Long
Dim r As Double
Dim angle As Double
Dim x As Double
Dim y As Double
For i = 0 To 40000
angle = STEP_PAI * i
r = 200 * Sin(angle * xisu)
x = r * Cos(angle)
y = r * Sin(angle)
PSet (x, y), lngColor
Next
End Sub
Private Sub Form_Click()
Dim i As Integer, j As Integer
i = 2 + Int(20 * Rnd)
j = 2 + Int(20 * Rnd)
xisu = i / j
Me.Caption = "n=" & i & "/" & j
drawPoint vbGreen
End Sub
Private Sub Form_Load()
Me.DrawWidth = 2
Me.BackColor = vbBlack
End Sub
Private Sub Form_Resize()
Me.Scale (-250, 250)-(250, -250)
End Sub