TeeCreateBitmap doesn't work if panel color is clWhite

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
jls
Newbie
Newbie
Posts: 27
Joined: Fri May 06, 2011 12:00 am

TeeCreateBitmap doesn't work if panel color is clWhite

Post by jls » Fri Aug 05, 2011 12:38 pm

If the color of the panel is clWhite, this code doesn't work:

ABitmap := Chart.TeeCreateBitmap;

The series is not visible.

This a workaround:
ABitmap := Chart.TeeCreateBitmap(TColor($FEFEFE), Chart.GetRectangle);

This seems to work since TColor($FEFEFE) <> the color of the panel.

How can this be fixed?



TeeChart v2011.03.30407
Delphi XE


Jørgen

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: TeeCreateBitmap doesn't work if panel color is clWhite

Post by Yeray » Mon Aug 08, 2011 8:15 am

Hello Jørgen,

I can't see any strange behaviour with the following code in v2011.03, am I missing something?
I see the same behaviour with clWhite and clRed.

Code: Select all

uses Chart, ExtCtrls;

var Chart1: TChart;
    Image1: TImage;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1:=TChart.Create(self);
  Chart1.Parent:=Form1;
  Chart1.Color:=clWhite; //clRed;

  Image1:=TImage.Create(self);
  Image1.Parent:=Form1;
  Image1.BoundsRect:=Chart1.BoundsRect;
  Image1.Top:=Chart1.Height;
end;

procedure TForm1.Button1Click(Sender: TObject);
var ABitmap: TBitmap;
begin
  ABitmap:=Chart1.TeeCreateBitmap;
  Image1.Picture.Bitmap:=ABitmap;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

jls
Newbie
Newbie
Posts: 27
Joined: Fri May 06, 2011 12:00 am

Re: TeeCreateBitmap doesn't work if panel color is clWhite

Post by jls » Mon Aug 08, 2011 12:59 pm

Added a sample that doesn't work

It is something wrong with load from stream

(It works the second time you click)

Jørgen
Attachments
Project2.zip
(84.96 KiB) Downloaded 520 times

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: TeeCreateBitmap doesn't work if panel color is clWhite

Post by Yeray » Tue Aug 09, 2011 9:06 am

Hello Jørgen,

Try forcing a Chart repaint after changing the color:

Code: Select all

  Chart1.Color := clRed; //works
  Chart1.Draw;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

jls
Newbie
Newbie
Posts: 27
Joined: Fri May 06, 2011 12:00 am

Re: TeeCreateBitmap doesn't work if panel color is clWhite

Post by jls » Tue Aug 09, 2011 9:42 am

It worked.

What is the reason?

Is it a bug?

Jørgen

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: TeeCreateBitmap doesn't work if panel color is clWhite

Post by Yeray » Tue Aug 09, 2011 2:42 pm

Hi Jørgen,

This is because TeeCreateBitmap function uses the internal Bitmap already created instead of creating a new one when UseBuffer=true (as per default). So another alternative would be setting it to false:

Code: Select all

Chart1.Canvas.UseBuffer:=false;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply