Narcís, okay, Dream Team it is...
I played with it a bit, and noticed a few things that might be of interest to others watching this thread, or reading it down the road in a search.
1) Your sample AfterDraw handler, which was great, had one small issue. The FormCreate border width of 25 in wasn't reflected in AfterChart's Pen.Width. Instead, it showed it at 50. I didn't notice that at first:
Code: Select all
procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
Chart1.Canvas.Brush.Style := bsClear;
Chart1.Canvas.pen.Color := clgreen;
Chart1.Canvas.pen.Width := 25; // <=== (Border.Width)
Chart1.canvas.RoundRect(Chart1.ChartBounds,50,50);
end;
Similarly, my code excerpt needed a parallel tweak:
Code: Select all
with Chart1.Canvas do begin
Brush.Style := bsClear;
Pen.Color := clrGetBackPanelBorder;
Pen.Width := iGetBackPanelBorderWidth; // <=== (Border.Width)
RoundRect( Chart1.ChartBounds, iRoundedAmt, iRoundedAmt ); //<== iRoundedAmt, *not* pen.width
end;
2) WHY do I bother pointing this out? This is the part that might be of interest to you. I found some value combinations of Pen.Width and the last two arguments to Chart1.Canvas.RoundedRect worked wonderfully. Others combinations not so hot, allowing the Chart's ChartBounds rect to peek out from each of the four corners, so they bled out of the rounded corners.
This general formula seems to work fine: Pen.Width < ( iRoundedAmt + 1 ) < Pen.Width * 2.5.
If, however, PenWidth was, say, 5, and the rounding amount passed as the last two parameters to RoundRect was 50 (both reasonable values), the back square peeks out of each corner.
So as long as the values used for Pen.Width and the rounding value are in a certain kind of relationship, this code works really well! Thank you AGAIN!
Regards,
richard diamond
p.s., I *was* surprised, and delighted, that Pep jumped in as well!