Page 1 of 1

TAnnotationTool AutoSize

Posted: Fri Dec 10, 2004 4:00 pm
by 9339785
Hi!

I have a pb when I set the property AutoSize of TAnnotationTool to TRUE .

The values returned by the properties height and width of the TAnnotationTool are always wrong (even TAnnotationTool.Shape.height and TAnnotationTool.Shape.width).

So how can I know the height and width of the TAnnotationTool ?

Thanks in advance.

Posted: Fri Dec 10, 2004 5:19 pm
by Pep
Hi ,

you can read TAnnotationTool->Shape->ShapeBounds rectangle to
get annotatiton tool bounding rectangle. The rest is easy :

TRect r = AnnotationTool->Shape->ShapeBounds;
Width = r.Right - r.Left;
Height = r.Bottom - r.Top;

Posted: Mon Dec 13, 2004 8:02 am
by 9339785
Thanks Pep,

The solution was quite easy .... but I've not found it :-)

Posted: Mon Dec 13, 2004 8:23 am
by 9339785
I wrote too quickly ... the solution you gave to me is not good because r.Right and r.Bottom are always null !

Any ideas?

Posted: Mon Dec 13, 2004 3:47 pm
by Pep
Hi,

this depends in which event you place the code, it works fine placing it in the OnAfterDraw event.

Posted: Tue Dec 14, 2004 8:53 am
by 9339785
Hi Pep,

I tested the value of AnnotationTool->Shape->Right and AnnotationTool->Shape->Bottom in the OnAfterDraw event and I always found 0 (perhaps due to the property AUTOSIZE = TRUE).

The only solution I have found is to recalculate manually the height and width of the AnnotationTool, like the function MultiLineTextWidth() into the unit TeEngine.pas. For the moment this solution is acceptable for me.

Bye