Ver Mensaje Individual
  #1  
Antiguo 13-04-2005
David78 David78 is offline
Registrado
 
Registrado: abr 2005
Posts: 3
Reputación: 0
David78 Va por buen camino
Crear un Shape en Runtime

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
Responder Con Cita