How to set all TeeChart Fonts

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
ulibru
Newbie
Newbie
Posts: 54
Joined: Tue Jul 21, 2009 12:00 am

How to set all TeeChart Fonts

Post by ulibru » Mon Sep 20, 2010 6:59 am

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

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: How to set all TeeChart Fonts

Post by Sandra » Tue Sep 21, 2010 11:31 am

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,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

ulibru
Newbie
Newbie
Posts: 54
Joined: Tue Jul 21, 2009 12:00 am

Re: How to set all TeeChart Fonts

Post by ulibru » Tue Sep 21, 2010 11:47 am

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: How to set all TeeChart Fonts

Post by Narcís » Wed Sep 22, 2010 2:15 pm

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

ulibru
Newbie
Newbie
Posts: 54
Joined: Tue Jul 21, 2009 12:00 am

Re: How to set all TeeChart Fonts

Post by ulibru » Wed Sep 22, 2010 2:30 pm

Hi Narcís,

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

Uli

Post Reply