# Board index » delphi » Transform tpoint

## Transform tpoint

Hi,

How can I transform a tpoint into an x and y coordinate?

Thanks.

## Re:Transform tpoint

Stange question...

var
P: TPoint;
begin
P := Point(1, 2);
Label1.Caption := IntToStr(P.X);
Label2.Caption := IntToStr(P.Y);
end;

"TP" <kevi...@pi.be> schreef in bericht
news:9jltpd\$qnp\$1@news.planetinternet.be...

##### Quote
> Hi,

> How can I transform a tpoint into an x and y coordinate?

> Thanks.

## Re:Transform tpoint

"TP" <kevi...@pi.be> skrev i melding
news:9jltpd\$qnp\$1@news.planetinternet.be...

##### Quote
> Hi,

> How can I transform a tpoint into an x and y coordinate?

var
x: integer;
y: integer;
SomePoint: TPoint;
begin
[...]
x:=SomePoint.x;
y:=SomePoint.y;

--
Bjoerge Saether
Consultant / Developer
http://www.itte.no
bjorge@takethisaway_itte.no (remve the obvious)

## Re:Transform tpoint

I think I can see where this one is coming from.

In VB the 'native' unit of measurement is a TWIP - which stands for
'TWentIeth of  Point' - and you have so many TWIPS per Pixel - my
monitor/setup is 15 TWIPS per Pixel (X axis)

In Delphi screen coordinates are measured in Pixels - but that is not
immediately obvious to someone coming from VB - well until one plays
with things and checks out the help system.

Also to someone coming from the 'old' days it is a bit confusing to
realize that there are sometimes a lot more 'real' pixels to a
'windows pixel' than one might think. I am of course thinking of LCD
screens.

The plot then thickens - when we use Fonts we generally specify their
size in ... Points ...  so what Kevin is probably really asking is
'how do I convert from Points into Pixels'

- the answer is to look at the Height property of a Font - which is
peculiarly generally negative.

My bet is that he is experimenting with TPrinter and wants to be able
to convert the 'native' pixels into centimetres.
Printer.Canvas.Font.PixelsPerInch

##### Quote
On Wed, 25 Jul 2001 09:51:35 +0200, "TP" <kevi...@pi.be> wrote:
>Hi,

>How can I transform a tpoint into an x and y coordinate?

>Thanks.

## Re:Transform tpoint

In article <3b5eb07f.16050...@news.u-net.com>, je...@iss.u-net.com (J French)
writes:

##### Quote
>- the answer is to look at the Height property of a Font - which is
>peculiarly generally negative.

That's because the Size property has been set (and set positive) and so
indicates the point size of the character without leading (pronounced
"ledding"). Negative Height is then a measurement in pixels, also without
leading. Setting a positive Height is a measurement of the character including
leading, the Size value then becomes negative and is a point measurement also

Confused <gg>

I have a small app which helps to explain some of the font settings. e-mail me
if you would like a copy.

Alan Lloyd
alangll...@aol.com

## Re:Transform tpoint

On 25 Jul 2001 19:57:32 GMT, alangll...@aol.com (AlanGLLoyd) wrote:

##### Quote
>In article <3b5eb07f.16050...@news.u-net.com>, je...@iss.u-net.com (J French)
>writes:

>>- the answer is to look at the Height property of a Font - which is
>>peculiarly generally negative.

>That's because the Size property has been set (and set positive) and so
>indicates the point size of the character without leading (pronounced
>"ledding"). Negative Height is then a measurement in pixels, also without
>leading. Setting a positive Height is a measurement of the character including
>leading, the Size value then becomes negative and is a point measurement also

Yes - Delphi yacks on about it being the 'top' of the font - but my
suspicion is that this is simply a neat way of aligning the base of
the font (excluding descendor) to a position on the canvas.

Is this roughly correct ?

##### Quote

>Confused <gg>

>I have a small app which helps to explain some of the font settings. e-mail me
>if you would like a copy.

>Alan Lloyd
>alangll...@aol.com