Charttool TRectangleTool - delete it
Posted: Mon Apr 14, 2014 10:50 am
Hi,
I added several rectangles at runtime by the code below.
How can I address one rectangle at runtime to delete it?
To do it with
" ........ .DeleteSelected;"
would be great.
Thanks,
Cheryll
===========================
adding code:
I added several rectangles at runtime by the code below.
How can I address one rectangle at runtime to delete it?
To do it with
" ........ .DeleteSelected;"
would be great.
Thanks,
Cheryll
===========================
adding code:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
with Chart1.Tools.Add(TRectangleTool) as TRectangleTool do
begin
Text:='Rectangle Tool 1';
AutoSize:=true;
Shape.Transparency:=0;
Left:=100;
Top:=75;
OnClick:=RectClick;
end;
end;
procedure TForm1.RectClick(Sender:TAnnotationTool; Button:TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if Button=mbRight then
begin
with Chart1.Tools.Add(TRectangleTool) as TRectangleTool do
begin
Text:=Sender.Text + ' (twin)';
AutoSize:=Sender.AutoSize;
Shape.Transparency:=Sender.Shape.Transparency;
Top:=Sender.Top+Sender.Height;
Left:=Sender.Left;
OnClick:=RectClick;
end;
end;
end;