Page 1 of 1

Setting border at runtime

Posted: Mon Nov 06, 2006 2:01 pm
by 9242408
How do I set the border at runtime for a chart?

I see nothing in the docs? Seems like that would be in there?


Thanks,

Tom

Posted: Mon Nov 06, 2006 3:28 pm
by narcis
Hi Tom,

You can use TChart.Border, for example:

Code: Select all

  With Chart1.Border do
  begin
    Visible:=true;
    Color:=clBlue;
    Width:=5;
  end;

Posted: Mon Nov 06, 2006 3:52 pm
by 9242408
Thanks,

I guess I am not use to using the With statement. I was looking for something like: Chart1.Border := .....but what to put after this is what I was not sure of?

Posted: Mon Nov 06, 2006 4:20 pm
by narcis
Hi Tom,

You can not use the with statement if you want. Anyway, you can use a variable of TChartHiddenPen type and use it like this:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var MyBorderPen: TChartHiddenPen;
begin
  MyBorderPen:=TChartHiddenPen.Create(Chart1.CanvasChanged);

  MyBorderPen.Visible:=true;
  MyBorderPen.Color:=clBlue;
  MyBorderPen.Width:=5;

  Chart1.Border:=MyBorderPen;
end;