Public Class Form1
Dim g As System.Drawing.Graphics
Dim pen1 As New System.Drawing.Pen(Color.Red, 0.5)
Const PI = 3.14159
Dim flag, col, r, h, hl, n, n1 As Short
Dim x, y, z, cx, cy, cz, thx, thy, thz As Single
Dim ed, od, eh As Short
Dim point1, point2, point3, point4, point5 As System.Drawing.Point
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PictureBox1.Refresh()
g = PictureBox1.CreateGraphics
Dim i, r As Integer
Dim x, y, z, s, q, p, px, py As Single
Dim mx(600), my(600) As Integer
s = PI / 4
r = 100
i = 1
q = -PI / 2 + 0.1
For p = 0 To 2 * PI Step 0.2
x = r * Math.Cos(q) * Math.Sin(p)
y = r * Math.Sin(q)
z = r * Math.Cos(q) * Math.Cos(p)
px = x * 1.2
py = y - z * Math.Sin(s)
mx(i) = px + 200
my(i) = 150 - py
i = i + 1
Next p
point1.X = mx(1) : point1.Y = my(1)
For q = -PI / 2 + 0.2 To PI / 2 Step 0.2
i = 1
For p = 0 To 2 * PI Step 0.2
x = r * Math.Cos(q) * Math.Sin(p)
y = r * Math.Sin(q)
z = r * Math.Cos(q) * Math.Cos(p)
px = x * 1.2
py = y - z * Math.Sin(s)
point2.X = px + 200 : point2.Y = 150 - py
g.DrawLine(pen1, point1, point2)
point1 = point2
point3.X = mx(i) : point3.Y = my(i)
point4.X = px + 200 : point4.Y = 150 - py
g.DrawLine(pen1, point3, point4)
point3 = point4
mx(i) = px + 200
my(i) = 150 - py
i = i + 1
Next p
p = 0
x = r * Math.Cos(q) * Math.Sin(p)
y = r * Math.Sin(q)
z = r * Math.Cos(q) * Math.Cos(p)
px = x * 1.2
py = y - z * Math.Sin(s)
point5.X = px + 200 : point5.Y = 150 - py
g.DrawLine(pen1, point4, point5)
point4 = point5
Next q
End Sub
End Class