Re: Measure point to point
- From: "Andy" <andy@xxxxxxxxx>
- Date: Fri, 31 Aug 2007 03:18:13 -0400
Hi Rabatscher,
Thanks very much on the code on how to get the measurements. I am trying
to draw a line between 2 points to show the measurement but also allow the
line to be moveable, sort of like an annotation object. Any idea on how to do
this or if I need any special tools?
Thanks again.
Andy
"Rabatscher Michael" <rabi@xxxxxx> wrote in message news:46d54e0a@xxxxxxxxxxxxxxxxxxxxxxxxx
Andy schrieb:I am trying to create a tray application that allows the user to measure 2 points on the screen, in pixels, mm, cm, etc. What tools/components do I need to get this done?
Any help is greatly appreciated.
Andy
Calculate the pixel distance (e.g. eucledian distance:
dx = pt1.x - pt2.x;
dy = pt1.y - pt2.y;
dist = sqrt(dx*dx + dy*dy);
you could then use the following function to get the scaling factor
function PixelsPerMM(Can : TCanvas) : double;
begin
try
result:=GetDeviceCaps(Can.Handle, HORZRES)/GetDeviceCaps(Can.Handle, HORZSIZE)
except
// exceptions raised when a beamer is attached
// HORZSIZE returns "0"
result:=getDeviceCaps(Can.handle, LOGPIXELSX)/25.4
end;
end;
distInMM = PixelPerMM(can)*dist;
.
- References:
- Measure point to point
- From: Andy
- Re: Measure point to point
- From: Rabatscher Michael
- Measure point to point
- Prev by Date: Re: Measure point to point
- Next by Date: Demo protection - Fixed life
- Previous by thread: Re: Measure point to point
- Next by thread: Re: Measure point to point
- Index(es):