|
-
March 11th, 2001, 04:11 PM
#1
lines not doing what they are told
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
-
March 12th, 2001, 12:30 AM
#2
Re: lines not doing what they are told
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
-
March 12th, 2001, 04:02 AM
#3
Re: lines not doing what they are told
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
-
March 12th, 2001, 06:24 AM
#4
Re: lines not doing what they are told
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
-
March 12th, 2001, 06:56 AM
#5
Re: lines not doing what they are told
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
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
|