TAnnotationTool AutoSize

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
franckgar
Advanced
Posts: 109
Joined: Thu Nov 04, 2004 5:00 am

TAnnotationTool AutoSize

Post by franckgar » Fri Dec 10, 2004 4:00 pm

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.
franckgar

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Fri Dec 10, 2004 5:19 pm

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;

franckgar
Advanced
Posts: 109
Joined: Thu Nov 04, 2004 5:00 am

Post by franckgar » Mon Dec 13, 2004 8:02 am

Thanks Pep,

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

franckgar
Advanced
Posts: 109
Joined: Thu Nov 04, 2004 5:00 am

Post by franckgar » Mon Dec 13, 2004 8:23 am

I wrote too quickly ... the solution you gave to me is not good because r.Right and r.Bottom are always null !

Any ideas?
franckgar

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Dec 13, 2004 3:47 pm

Hi,

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

franckgar
Advanced
Posts: 109
Joined: Thu Nov 04, 2004 5:00 am

Post by franckgar » Tue Dec 14, 2004 8:53 am

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
franckgar

Post Reply