Width of a hidden title frame?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
QuestBack
Newbie
Newbie
Posts: 2
Joined: Wed Oct 27, 2004 4:00 am
Contact:

Width of a hidden title frame?

Post by QuestBack » Wed Nov 10, 2004 2:53 pm

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.

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

Post by Pep » Wed Nov 10, 2004 3:36 pm

Hi,

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

QuestBack
Newbie
Newbie
Posts: 2
Joined: Wed Oct 27, 2004 4:00 am
Contact:

Post by QuestBack » Thu Nov 11, 2004 11:31 am

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.

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Thu Nov 11, 2004 12:05 pm

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.
Marjan Slatinek,
http://www.steema.com

Post Reply