Page 1 of 1

Width of a hidden title frame?

Posted: Wed Nov 10, 2004 2:53 pm
by 9339707
Is there a way to retrieve the width of the title frame when the form with the tchart component is hidden? Both the width and the rect of the title returns 0 when viewed. If not, is there another way it is possible to cut the length of a text to fit the frame without using "Adjust Frame"?

This is used for a webservice so the tchart component has to be hidden.

Posted: Wed Nov 10, 2004 3:36 pm
by Pep
Hi,

you can get the width of the Title using the following code :
TittleWidth:=Chart1.Canvas.TextWidth(Chart1.Title.Text[0]);

Posted: Thu Nov 11, 2004 11:31 am
by 9339707
Thanks for the response. This will give me the width of the text, but the text can be wider then the frame, if adjustframe is false. I can get the correct width of the frame with Chart1.Title.Width, but this will return "0" if the Chart is hidden.

Edit: I found a solution to the problem. If I call Chart1.Draw before I try to get the value from Chart1.Title.Width I will get the number I want. If there is some other way to only process the title frame I would appreciate the help, but this will do for now.

Posted: Thu Nov 11, 2004 12:05 pm
by Marjan
Hi.
If I call Chart1.Draw before
Using the Draw method to construct a chart "behind the scene" and then retrieve specific chart object size is a way to go.