Ver Mensaje Individual
  #3  
Antiguo 15-03-2005
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.333
Reputación: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Cita:
Empezado por YolandaM
Necesito crear dinamicamente en una form x paneles con sus labels y sus edits.
Programa un botón conel siguiente código:

Código Delphi [-]
 procedure TForm1.Button1Click(Sender: TObject);
 var
   i, cont:Integer;
   p:TPanel;
   edt:TEdit;
 begin
 
   cont := StrToInt(Edit1.Text);
 
   for i := 0 to (cont-1) do begin
     p := TPanel.Create(Self);
     p.Left := (20 * i);
     p.Top := 0;
     p.Width:= 20;
     p.Height := 20;
     p.ParentWindow := Self.Handle;
     p.Name := 'panel' + IntToStr(i);
 
     // Un Edit;
     edt := TEdit.Create(Self);
     edt.Left := 5;
     edt.Top := 5;
     edt.Width:= 10;
     edt.ParentWindow := p.Handle;
     edt.Name := 'pEdit' + IntToStr(i);
   end;
 end;

Necesitas un Edit (Edit1) que te indica cuantos debes crear.

Un consejo: Si los "BLOQUES" que debes crear son complejos, tal vez te interese crear un Frame en diseño, añadirle todo lo que necesitas y luego en ejecución crear elementos del tipo de ese Frame.
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita