Shapes at Runtime?



I create shapes at runtime and would like to have the user click a
label and change the shapes color to the same color as the shape.
The code below is what I am working with. Why does it not work?


procedure TForm1.Button1Click(Sender: TObject);
var
NewShape : TShape;
begin
NewShape := Tshape.Create(self);
NewShape.Left := 100;
NewShape.Top := 80;
NewShape.Parent := Self;

end;

procedure TForm1.Label1Click(Sender: TObject);
var
NewShape : TShape;
begin
if Sender is TShape then with Sender as TShape do
Begin
NewShape.Brush.Color:=label1.Color;

end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin

end;

end.
.


Quantcast