1

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

ZioBit
  • 905
  • 10
  • 29

2 Answers2

3

TBackImage is a class whose methods you must call.

Chart.BackImage.LoadFromFile('full/path/to/imagefile');
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • Ok, so those patterns in the "gallery" section are real files, and are not already embedded in the object? I just want to be sure, because I am more than happy with them, and I'd like to avoid inserting another external file if not needed. Thank you. – ZioBit Oct 10 '15 at 12:00
  • @ZioBit yes, they are accessible via TBrushDialog class. Please see my reply. – Narcís Calvet Oct 14 '15 at 09:02
1

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;
Narcís Calvet
  • 7,304
  • 5
  • 27
  • 47