Page 1 of 1

TCustomTeeGradient.DrawRadial

Posted: Tue May 23, 2006 12:23 pm
by 9345063
Hi,
I have found a bug in TCustomTeeGradient.DrawRadial (v.7.07), line 6441,6442 in TeCanvas.pas:

Step:=Math.Min(255,Math.Max(SizeX,SizeY));
InvStep:=1/Step;

if you pass an empty TRect to the procedure Step = 0 and division by 0 is raised.

Thanks

Posted: Tue May 23, 2006 12:54 pm
by narcis
Hi Alessandro,

Could you please send us an example we can run "as-is" or the steps we should follow to reproduce the problem here?

You can post your files at news://www.steema.net/steema.public.attachments newsgroup.

Thanks in advance.

Posted: Tue May 23, 2006 1:05 pm
by 9345063
Hi Narcis, in my project I return an empty rect in OnGetLegendRect event.
If the gradient style of the legend is radial the error occurs. You shoud test that the rect passed to the procedure is not empty. You can easily find the potential error in the source of TeCanvas.

Thanks.

Posted: Tue May 23, 2006 1:33 pm
by narcis
Hi Alessandro,

I'm unable to reproduce the problem here using this code:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.FillSampleValues();
  Chart1.Legend.Gradient.Direction:=gdRadial;
end;

procedure TForm1.Chart1GetLegendRect(Sender: TCustomChart;
  var Rect: TRect);
begin
  Chart1.Title.Text[0]:=IntToStr(Rect.Left)+', '+
                        IntToStr(Rect.Top)+', '+
                        IntToStr(Rect.Right)+', '+
                        IntToStr(Rect.Bottom);
end;
Can you please modify it or send us an example so that we can reproduce the problem here?

Thanks in advance.