'''''''''''''''''''''''''''''''''''''''''''''''''
Public Class Form1
Dim pt() As PointF
Const pi = 3.1415926
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Static intJ As Long
Dim g As Graphics
Dim i As Int16
g = Me.CreateGraphics()
If TextBox1.Text <> "" And TextBox2.Text <> "" Then
ReDim Preserve pt(intJ)
pt(intJ).X = Val(TextBox1.Text) * Math.Cos(Val(TextBox2.Text) * pi / 180)
pt(intJ).Y = Val(TextBox1.Text) * Math.Sin(Val(TextBox2.Text) * pi / 180)
Call Change(pt(intJ))
If intJ >= 1 Then
g.Clear(Me.BackColor)
g.DrawCurve(Pens.Black, pt)
End If
For i = 0 To intJ
g.DrawEllipse(Pens.Red, pt(i).X, pt(i).Y _
, 2, 2)
Next
TextBox1.Text = ""
TextBox2.Text = ""
intJ += 1
Else
MsgBox("请在左边输入长度,右边输入角度 ")
Exit Sub
End If
End Sub
Private Sub Change(ByRef ptF As PointF)
ptF.X = ptF.X + Me.Width / 2
ptF.Y = Me.Height / 2 - ptF.Y
End Sub
End Class
''''''''''''''''''''''''''''''''''''''''''''''''''