Solved

# Draw a Circle with Spokes

Posted on 1999-07-05
Medium Priority
556 Views
Win95/VB5 Pro:
I want to draw a Circle with radius of any length. Then use Line function to draw spokes(radius) at every 10 or 20 degrees (programmable).  I understand that this is math oriented but wonder if anyone can help.
0
Question by:et1dkn
• 5

LVL 10

Accepted Solution

caraf_g earned 1200 total points
ID: 1522043
I put a sample for you in the following web site:

homepage.tinet.ie/~carafa/VBSamples/Spokes.zip
0

LVL 10

Expert Comment

ID: 1522044
I hope this works for you - I have VB5 Enterprise edition. If not, it just contains a simple form with
1 button
1 text box
1 label saying "Spokes"

The idea is that you enter the number of spokes in the text box and then hit the button which will draw the requested circle with spokes. Leave the top left of the form blank so there is space for the circle to be displayed.

The code in the form module follows in the next comment.
0

LVL 10

Expert Comment

ID: 1522045
Option Explicit

Private Sub Command1_Click()

Me.Cls

Dim Pi As Double
Dim intSpokes As Integer
Dim intCount As Integer

intSpokes = Val(Text1.Text)

Pi = 3.141592653

Me.Circle (1000, 1000), 1000

Dim dblX As Double
Dim dblY As Double

For intCount = 0 To intSpokes - 1
dblX = 1000 * Cos(intCount * ((2 * Pi) / intSpokes))
dblY = 1000 * Sin(intCount * ((2 * Pi) / intSpokes))
Me.Line (1000, 1000)-(1000 + dblX, 1000 + dblY)
Next

End Sub

0

LVL 10

Expert Comment

ID: 1522046
(You only need to worry about those last two comments if you can't download the .zip file from the site, or if it won't work in VB5 prof..)
0

Author Comment

ID: 1522047
C:

Thanks much for your quick answer...been a LONG time since my last Geometry class..Thanks for breaking the log jam.

Respects

Dan

0

LVL 10

Expert Comment

ID: 2096532
The zip file has been removed from my homepage
0

## Featured Post

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.