Page 1 of 1

How to set all TeeChart Fonts

Posted: Mon Sep 20, 2010 6:59 am
by 10553945
Hi,

switching from XP to Vista to Win7 I have learnt that I can use
DesktopFont := true;
to adopt the appliction to the standard fonts of the operating system.

TeeChart defines a lot of fonts (according to the chart editor). It seems that these fonts do not adopt to the desktop font.
How to achieve the correct behaviour or how to set all fonts by the application program (do I really need to define the font of each TeeChart component) ?

Thanks
Uli

Re: How to set all TeeChart Fonts

Posted: Tue Sep 21, 2010 11:31 am
by 10050769
Hello Uli,
switching from XP to Vista to Win7 I have learnt that I can use DesktopFont := true; to adopt the appliction to the standard fonts of the operating system.TeeChart defines a lot of fonts (according to the chart editor). It seems that these fonts do not adopt to the desktop font.
I have added your request in wish list with number [TV52015164]to be revised in future releases.
How to achieve the correct behaviour or how to set all fonts by the application program (do I really need to define the font of each TeeChart component) ?
You can define font of each TeeChart components for example in design time with Editor, following next steps:

-Open TChart Editor
-Select Tabs Chart->General->Fonts.
-Select All Fonts with checkbox.
-Select to the Name font as you want, with comboBox.


I hope will helps.

Thanks,

Re: How to set all TeeChart Fonts

Posted: Tue Sep 21, 2010 11:47 am
by 10553945
Hello Sandra,

setting the fonts by the ChartEditor is clear.
But I like to define/change it at runtime. Then I can e.g. automatically set the font to Screen.IconFont (which may vary from XP to Vista to Windows7) How to set the different control.font properties at runtime?

Regards, Uli

Re: How to set all TeeChart Fonts

Posted: Wed Sep 22, 2010 2:15 pm
by narcis
Hi Uli,

In that case you can do something similar to what the editor does (see example below). If you are a source code customer you can have a look at TeeEdiGene.pas.

Code: Select all

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, TeEngine, Series, TeeComma, ExtCtrls, TeeProcs, Chart, StdCtrls,
  TeCanvas;

type
  TForm1 = class(TForm)
    Chart1: TChart;
    TeeCommander1: TTeeCommander;
    Series1: TBarSeries;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
    FontList  : TStringList;
    function SelectedFont(Index:Integer):TTeeFont;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses TeeEdiGene;

function TForm1.SelectedFont(Index:Integer):TTeeFont;
var tmp : TObject;
begin
  tmp:=FontList.Objects[Index];

  if tmp is TTeeCustomShape then
     result:=TTeeCustomShape(tmp).Font
  else
  if tmp is TChartAxis then
     result:=TChartAxis(tmp).LabelsFont
  {$IFDEF D6}
  else
  if tmp is TChartSeries then
     result:=FontOfPersistent(tmp as TPersistent,TChartSeries(tmp).Marks.Font)
  else
     result:=FontOfPersistent(tmp as TPersistent);
  {$ELSE}
  else
     result:=nil;
  {$ENDIF}
end;

procedure TForm1.FormCreate(Sender: TObject);
var t   : Integer;
    tmp : TTeeFont;

begin
  FontList:=TStringList.Create;
  FontList.Clear;
  TFormTeeGeneral.GetChartObjects(Chart1, FontList, True);

  for t:=0 to FontList.Count-1 do
  begin
    tmp:=SelectedFont(t);

    tmp.Name:='Times New Roman';
    tmp.Size:=14;
    tmp.Style:=[fsBold];
    tmp.Color:=clRed;
    tmp.InterCharSize:=5;
    tmp.Shadow.HorizSize:=5;
    tmp.Shadow.VertSize:=12;
    tmp.Shadow.Color:=clRed;
    tmp.Shadow.Visible:=True;
    tmp.Shadow.Transparency:=50;
    tmp.Shadow.Smooth:=True;
    tmp.Gradient.Visible:=True;
  end;
end;

end.

Re: How to set all TeeChart Fonts

Posted: Wed Sep 22, 2010 2:30 pm
by 10553945
Hi NarcĂ­s,

thanks. I have already looked at TeeEditGene.pas and found the code for GetChartObjects.
I appreciate your example code.

Uli