Click to See Complete Forum and Search --> : lines not doing what they are told


Timg
March 11th, 2001, 03:11 PM
I'm using input boxes to gather "X1 and X2" values to draw lines.
When I input 1 inch, for instance, as a line length. I get something like 0.9991784 as what the line believes to be it's end point. While this is not necessarily a great difference, it becomes a spoiler later, when that point is needed for making a calculation involving an angle.
I don't have this difficulty with the "Y1 and Y2"
points which are determined the same way.
I've tried using various methods(Creating an integer variable which passes it's value for one) to force the line to accept the input or calculated value with no success.
Any suggestions?
TIA
Timg

phil m
March 11th, 2001, 11:30 PM
That will happen Tim. I've been through it before. I think I got around it by formatting it to take no decimal places.

Might you also input the value as a string and then use cint(mystring) afterwards.

Phil

Clearcode
March 12th, 2001, 03:02 AM
Try changing the mapping mode to something like "Twips".
A line must be a whole number of mapping units long. If you have your mapping mode set to pixels and put in one inch, you would end up with 72.1 ish pixels. Once the line is drawn it becomes 72 pixels, and converting that back to inches is .9....

HTH,
Duncan

-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com

Timg
March 12th, 2001, 05:24 AM
Ok, Now the value of .X1 and .X2 are correct but using twip for that and drawing the line at the correct place on the form and at the correct length is confusing me.
Should I perform some calculation with twip as a factor to draw the lines where I want them?
I believe I'm way over my head with this one.
Thanks
Timg

Clearcode
March 12th, 2001, 05:56 AM
There are 1440 twips in an inch.

The number of twips in a pixel depends on your screen resolution, but the visual basic "Screen" object has a memeber that you can use to find this:

xPixel = xTwips / Screen.TwipsperPixelX
yPixel = yTwips / Screen.TwipsPerPixelY




HTH,
Duncan


-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com