ZioBit
ZioBit

Reputation: 975

Changing background image in TeeChart Delphi XE8 at run-time

I would like to use the gallery pictures (Metal, Wood, Stone, Clouds, etc.) which are available at design time under Chart/Panel/Image/Gallery.

If I set it at design time, I can easily disable it at run time with:

 g.backImage := nil;

But if I want to set it to a particular value, e.g. with

 g.backImage := 'metal';

I get an 'Incompatible types' error, because the compiler requires a TBackImage value. I do not have the source codes, and I cannot find the appropriate values on several Google searches.

Thinking that it could be just an enum, I tried typecasting it to one:

 g.backImage := TBackImage(1);

But it generates an exception. I also tried to "guess" the names, like tbiMetal, tbMetal, tMetal, and so on, to no avail...

What are those values?! Thank you

Upvotes: 1

Views: 498

Answers (2)

Narcís Calvet
Narcís Calvet

Reputation: 7452

Those are real texture images embedded in TBrushDialog, they can be used/accessed like this:

uses TeeBrushDlg;

procedure TForm1.FormCreate(Sender: TObject);
var BrushDialog: TBrushDialog;
begin
  BrushDialog:=TBrushDialog.Create(Self);
  Chart1.BackImage.Graphic:=BrushDialog.ImageCarbon.Picture.Graphic;
end;

Upvotes: 1

David Heffernan
David Heffernan

Reputation: 613582

TBackImage is a class whose methods you must call.

Chart.BackImage.LoadFromFile('full/path/to/imagefile');

Upvotes: 3

Related Questions