Hi!
I need to do a little drawing with VB...
I got 3 numbers, 12 degrees, 45 minutes, 35 seconds.
I need to draw a circle and in the position 12deg45'35" I need to place an X over the circle.
Does anyone knows how can I do that???? :S
I assume want to draw the angle CCW from the x-axis with the point to the right of the center of the circle.
Place a button on a form, set autoredraw=true, and scalemode=pixels.
Note that 45' is 45/60 of a degree
and 35" is 35/3600 of a degree.
Option Explicit
Private Sub Command1_Click()
Dim Angle As Single, Arad As Single
Dim Adj As Single, Opp As Single, Hyp As Single
Dim x As Long, y As Long
The following should work by calculating the offsets.
Private Sub Command1_Click()
Dim Angle As Single, Arad As Single
Dim circrad As Single
Dim x As Long, y As Long
Dim PI
PI = (4 * Atn(1))
circrad = 2000 'set radius
Angle = 12 + (45 / 60) + (35 / 3600)
Arad = Angle * PI / 180 ' convert to rads
x = 3000: y = 3000 ' set center of circle
Circle (x, y), circrad ' draw circle
CurrentX = x + Sin(Arad) * circrad 'calc x offset
CurrentY = y - Cos(Arad) * circrad - 80 ' calc y offset & print offset
Print "x"
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.