Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #7  
Antiguo 24-05-2012
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Poder: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Cita:
Empezado por PaulaGV Ver Mensaje
probé el código, y esta muy bueno, pero no es exactamente lo que yo quiero hacer...
Hola Paula.

A ver si con este código nos aproximamos un poco a lo que buscas:
Código Delphi [-]
implementation

uses Contnrs;

var
  Pila: TStack;
  Shape: TShape;

(* Crear Stack, valores iniciales *)
procedure TForm1.FormCreate(Sender: TObject);
begin
  WindowState:= wsMaximized;
  Pila:= Tstack.Create;
  ListBox1.Align:= alLeft;
  Randomize;
end;

(* Agregar un Shape *)
procedure TForm1.btnAgregarClick(Sender: TObject);
begin
 Shape:= TShape.Create(Self);
  with Shape do
  begin
    Height:= 150;
    Width := 250;
    Left:= Random(Self.ClientWidth-500)+250;
    Top := Random(Self.ClientHeight-320)+150;
    Brush.Color:=RGB(Random(255),Random(255),Random(255));
    case Random(6) of
      0:begin
          Shape:= stCircle;
          ListBox1.Items.Add('Circulo');
      end;
      1:begin
          Shape:=stRectangle;
          ListBox1.Items.Add('Rectangulo');
        end;
      2:begin
          Shape:=stSquare;
          ListBox1.Items.Add('cuadrado');
        end;
      3:begin
          Shape:=stRoundRect;
          ListBox1.Items.Add('Rectangulo bordes redondeado');
        end;
      4:begin
          Shape:=stEllipse;
          ListBox1.Items.Add('elipse');
        end;
      5:begin
          Shape:=stRoundSquare;
          ListBox1.Items.Add('cuadrado bordes redondeado');
        end;
    end;
    case Random(6) of
      0:Pen.Style:=psSolid;
      1:Pen.Style:=psDash;
      2:Pen.Style:=psDot;
      3:Pen.Style:=psDashDot;
      4:Pen.Style:=psDashDotDot;
      5:Pen.Style:=psClear;
    end;
    Parent:= Self;
  end;
  pila.Push(Shape);
end;

(* Borrar un Shape *)
procedure TForm1.btnBorrarClick(Sender: TObject);
var
  i: Integer;
begin
  if Pila.Count > 0 then
  begin
    TShape(Pila.Pop).Free;
    ListBox1.Items.Delete(ListBox1.Count-1);
  end;
end;

(* Borrar todos los Shapes *)
procedure TForm1.btnBorraTodoClick(Sender: TObject);
var
  i: Integer;
begin
  for i:= Pila.Count-1 downto 0 do
    TShape(Pila.Pop).Free;
end;

(* Liberar *)
procedure TForm1.FormDestroy(Sender: TObject);
var
  i: Integer;
begin
  for i:= Pila.Count-1 downto 0 do
    TShape(Pila.Pop).Free;
  Pila.Free;
end;

Saludos.
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Una ayudita con TShape JerS Varios 8 28-04-2010 04:07:11
Error Tshape el compilar URBANO Varios 6 04-12-2009 20:29:26
Cómo dibujar una línea en un TShape Patricio Varios 1 18-02-2009 17:21:36
Componente TShape con Label? Jorge Rojas M. OOP 8 26-03-2008 01:11:33
Un TShape con personalidad elcigarra Gráficos 7 21-07-2005 04:47:00


La franja horaria es GMT +2. Ahora son las 03:03:32.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi