简体   繁体   中英

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, eg 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

TBackImage是一个必须调用其方法的类。

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

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM