|
-
Jul 1st, 2000, 05:31 AM
#1
Thread Starter
Lively Member
Hi,
I'm trying to make sort of a pie chart. I have a circle and a line that appear when my form loads. I also have a textbox and a command button. The idea is this: a person enters a number into the textbox, and when they click the command button the figure entered in text1 is given as an angle with the line at Form_Activate, from the centre of the circle:
Private Sub Form_Activate()
Circle (1000, 1000), 1000
'north
Line (1000, 1000)-(1000, 0)
'east
'Line (1000, 1000)-(2000, 1000)
'west
'Line (1000, 1000)-(0, 1000)
'south
'Line (1000, 1000)-(1000, 2000)
End Sub
'and when they click command button:
Private Sub Command1_Click()
Line (1000, 1000)-(1000 + Text1 * 11.11, 0 + Text1 * 11.11)
End Sub
The way I had planned was by getting the X2 and Y2 coordinates of two lines, both of length 1000, for 0 degress and for 90 degress, from the centre of the circle.
These coordinates are:
0 degrees: (1000,0)
90 degrees: (2000,1000)
Then I divided 1000 by 90, which is 11.11 (Let this equal 1 degree). So if someone enters 10 in text1, the X2 coordinates of the line will move 1000 + 10 times 11.11, and the Y2 coordinates will move 10 times 11.11.
But it doesn't work. It works fine for 90 degrees, exactly, but the lines are all different lengths for different angles, apart from that.
So in a nutshell, how can I draw lines at an angle (whose size is specified in text1) with the line at Form_Activate, from the centre of the circle?
Thanks for any help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|