David78
13-04-2005, 01:54:24
Hola a todos,
Estoy intentando crear un Shape en tiempo de ejecución, pero no sé por qué no me lo hace. Con TButton sí que lo consigo fácilmente. El código que he hecho es el siguiente:
procedure TForm1.CreateShape;
var AShape: TShape;
begin
AShape:= TShape.Create(Panel1);
try
with AShape do
begin
Parent:= Self;
Left:= Random(Form1.ClientWidth-Width);
Top:= Random(Form1.ClientHeight-Height);
Brush.Color:= clWhite;
Brush.Style:= bsSolid;
Pen.Color:= clBlack;
Pen.Mode:= pmCopy;
Pen.Style:= psSolid;
Pen.Width:= 1;
end;
except
AShape.Free;
end;
end;
gracias por adelantado,
David
Estoy intentando crear un Shape en tiempo de ejecución, pero no sé por qué no me lo hace. Con TButton sí que lo consigo fácilmente. El código que he hecho es el siguiente:
procedure TForm1.CreateShape;
var AShape: TShape;
begin
AShape:= TShape.Create(Panel1);
try
with AShape do
begin
Parent:= Self;
Left:= Random(Form1.ClientWidth-Width);
Top:= Random(Form1.ClientHeight-Height);
Brush.Color:= clWhite;
Brush.Style:= bsSolid;
Pen.Color:= clBlack;
Pen.Mode:= pmCopy;
Pen.Style:= psSolid;
Pen.Width:= 1;
end;
except
AShape.Free;
end;
end;
gracias por adelantado,
David