Dim a As IntegerDim x As Single, y As Single, i As SingleConst PI = 3.1415926Private Sub Form_Load()Form1.AutoRedraw = TrueForm1.Caption = "量角器"Form1.Width = 16000Form1.Height = 10000For i = 0 To 180 Step 0.1x = 8000 + 7000 * Cos(i / 180 * PI)y = 8000 - 7000 * Sin(i / 180 * PI)PSet (x, y)NextLine1.X1 = 1000Line1.Y1 = 8000Line1.Y2 = Line1.Y1Line1.X2 = 15000Line2.X1 = 8000Line2.Y1 = Line1.Y1Line2.X2 = Line2.X1Line2.Y2 = 1000Line3.BorderColor = vbRedLine3.X1 = Line2.X1Line3.Y1 = Line2.Y1Line4(0).Visible = FalseLine5(0).Visible = FalseLine6(0).Visible = FalseLine7.BorderColor = vbGreenFor a = 1 To 17If a <> 9 ThenLoad Line4(a)Line4(a).Visible = TrueLine4(a).X1 = 8000 + 7000 * Cos(a * 10 / 180 * PI)Line4(a).Y1 = 8000 - 7000 * Sin(a * 10 / 180 * PI)Line4(a).X2 = 8000 + 6500 * Cos(a * 10 / 180 * PI)Line4(a).Y2 = 8000 - 6500 * Sin(a * 10 / 180 * PI)End IfNext aFor a = 1 To 35If a Mod 2 <> 0 ThenLoad Line5(a)Line5(a).Visible = TrueLine5(a).X1 = 8000 + 7000 * Cos(a * 5 / 180 * PI)Line5(a).Y1 = 8000 - 7000 * Sin(a * 5 / 180 * PI)Line5(a).X2 = 8000 + 6700 * Cos(a * 5 / 180 * PI)Line5(a).Y2 = 8000 - 6700 * Sin(a * 5 / 180 * PI)End IfNext aFor a = 1 To 179If a Mod 10 <> 0 ThenLoad Line6(a)Line6(a).Visible = TrueLine6(a).X1 = 8000 + 7000 * Cos(a / 180 * PI)Line6(a).Y1 = 8000 - 7000 * Sin(a / 180 * PI)Line6(a).X2 = 8000 + 6800 * Cos(a / 180 * PI)Line6(a).Y2 = 8000 - 6800 * Sin(a / 180 * PI)End IfNext aLabel1(0).Visible = FalseLabel1(0).Width = 400Label1(0).Height = 150Dim z As StringFor a = 0 To 180 Step 10If a <> 0 Then Load Label1(a)Label1(a).Visible = Truez = a "°"Label1(a).Caption = zx = 7600 + 7500 * Cos(a / 180 * PI) + a / 180 * 400y = 7900 - 7200 * Sin(a / 180 * PI)Label1(a).Top = Int(y)Label1(a).Left = Int(x)NextLabel2.Width = 1400Label2.Height = 260End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)Dim xn As Single, yn As Single, kx As Single, ky As Single, k As SingleDim d As Single, d1 As Integer, d2 As Integer, d3 As SingleIf y > 8000 ThenLine3.Visible = FalseLine7.Visible = FalseElseLine3.Visible = TrueLine7.Visible = TrueLine3.X2 = xLine3.Y2 = yLine7.X1 = xLine7.Y1 = yxn = x - 8000yn = y - 8000If xn = 0 Thenxn = xn + 8000yn = 8000d = 90ElseIf yn = 0 ThenIf xn < 0 Thenxn = 0d = 180Elsexn = 16000d = 0End IfElsed = Atn(yn / xn) / PI * 180If xn > 0 Then d = -dIf xn < 0 Then d = 180 - dkx = 8000 / Abs(xn)ky = 8000 / ynIf kx > ky Thenk = kyElsek = kxEnd Ifxn = 8000 - xn * kyn = 8000 - yn * kEnd IfLine7.X2 = xnLine7.Y2 = ynd1 = Int(d)d2 = Int((d - d1) * 60)d3 = Round(((d - d1) * 60 - d2) * 60, 2)Label2.Caption = d1 "°" d2 "'" d3 """"Label2.Left = 8000 + 7000 * Cos(d / 180 * PI)Label2.Top = 8000 - 7000 * Sin(d / 180 * PI)End IfEnd Sub