Thanks Andrew
For some reason i'm not quite getting the result I require. I'm not quite
sure what i'm doing wrong. If I either post or email the code would you
have a look at it for me?
I did a little bit of programming in VB6 quite a few years ago (a VERY
little bit!) and am trying to update a couple of calculation programs for
use on a Pocket PC. I seem to be spending hours on trying to get the
simplist things to work and my 48 yr old brain is struggling to keep up with
the progression of the language!
As i've already stated, i'm still very new to VB.Net and my code is probably
very poor. Also, i've probably gone about things in completely the wrong
way, but I am trying to learn as I go ;-)
Cheers
Jem
"Andrew Morton" <ak*@in-press.co.uk.invalidwrote in message
news:OW**************@TK2MSFTNGP03.phx.gbl...
Jem wrote:
>I have the following code which draws a vertical line on a form...
Dim VertCrossHairX1 As Integer = 75
Dim VertCrossHairX2 As Integer = 75
Dim VertCrossHairY1 As Integer = 70
Dim VertCrossHairY2 As Integer = 80
By altering the values in the variablesI am able to rotate this line.
The question is - How do I obtain the angle of the line each time it
is rotated to a different angle? I would like the variable 'Angle'
to store this value for use in a calculation.
Angle=Math.Atan2(VertCrossHairY2-VertCrossHairY1,
VertCrossHairX2-VertCrossHairX1)
(I might have the 1 and 2 round the wrong way).
Note that gives the angle in radians. You may want to convert to degrees.
And strictly speaking, a line does not intrinsically have an angle - it
has an angle /relative to something else/, which may be why your googling
didn't produce a useful result.
HTH
Andrew