Draw a Circle with Spokes

Posted on 1999-07-05
Medium Priority
Last Modified: 2006-11-17
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.
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:

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.
LVL 10

Expert Comment

ID: 1522045
Option Explicit

Private Sub Command1_Click()


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)

End Sub

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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..)

Author Comment

ID: 1522047

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



LVL 10

Expert Comment

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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question