Ver Mensaje Individual
  #1  
Antiguo 09-04-2013
elguille elguille is offline
Miembro
 
Registrado: ene 2005
Posts: 114
Reputación: 20
elguille Va por buen camino
Tiempo de proceso excesivo

Tengo la siguiente función que crea en tiempo de ejecución grupos de 7 componentes y le asigna propiedades y eventos , la llamo al crear el form n veces donde n varia entre 100 y 300... mi problema es que con un ordenador de última generación esta 9 o 10 segundos para crear los componentes y al trasladarlo a mi cliente sera inoperativo, ¿ se os ocurre porque tarda tanto ? creo que debería ser mucho mas rápido...

Otra cosa, al mover de sitio todos esos componentes veo como se van dibujando en pantalla grupo por grupo, y eso sin emplear la función processmesages ¿existe alguna manera de indicar al form que no se vea nada hasta que lo haya redibujado todo?

Gracias anticipadas

Código Delphi [-]
function Tfplaning0.crecom(mnumero: integer): integer;
var
  mpanel1,mpanel: tpanel;
  mjab: tjanarrowbutton;
  mjarn: tjanhexbutton;
  mjarn2: tjanhexbutton;
  mjeb: tjanarrowrbutton;
begin
  mpanel := tpanel.create(self);
  mpanel.Parent := self;
  mpanel.Name := 'pa'+inttostr(mnumero);
  mpanel.Top := p1001.top;
  mpanel.PopupMenu := p1001.PopupMenu;
  mpanel.Enabled := p1001.Enabled;
  mpanel.Left := p1001.left;
  mpanel.Height := p1001.Height;
  mpanel.Width := p1001.Width;
  mpanel.Align := p1001.Align;
  mpanel.Alignment := p1001.Alignment;
  mpanel.BevelInner := p1001.BevelInner;
  mpanel.BevelOuter := p1001.BevelOuter;
  mpanel.BevelWidth := p1001.BevelWidth;
  mpanel.Font.Color := p1001.Font.Color;
  mpanel.Caption := '';
  mpanel.Color := clwhite;
  mpanel.Font.Size := p1001.Font.Size;
  mpanel.Font.Name := p1001.Font.Name;
  mpanel.Font.Size := p1001.Font.Size;
  mpanel.Tag := 1;
  mpanel.Visible := p1001.Visible;
  mpanel.ShowHint := p1001.ShowHint;
  mpanel.OnMouseDown := p1001MouseDown;
  mpanel.OnMouseMove := p1001MouseMove;
  mpanel.OnMouseUp := p1001MouseUp;
  mpanel.OnDblClick := p1001DblClick;
  mpanel.OnClick := p1001Click;
  mpanel.OnContextPopup := p1001ContextPopup;
  mpanel1 := tpanel.create(self);
  mpanel1.Parent := self;
  mpanel1.Name := 'p1'+inttostr(mnumero);
  mpanel1.Top := p1001.top;
  mpanel1.Enabled := false;
  mpanel1.Left := p1001.left;
  mpanel1.Height := p1001.Height;
  mpanel1.Width := p1001.Width;
  mpanel1.Caption := '';
  mpanel1.Color := clwhite;
  mpanel1.Tag := 1;
  mpanel1.Visible := p1001.Visible;
  mjab := tjanarrowbutton.create(self);
  mjab.Parent := self;
  mjab.Name := 'b1'+inttostr(mnumero);
  mjab.Align := b1001.Align;
  mjab.Caption := b1001.Caption;
  mjab.Color := b1001.Color;
  mjab.Enabled := b1001.Enabled;
  mjab.Flat := b1001.Flat;
  mjab.FlatArrow := b1001.FlatArrow;
  mjab.FlatBorderColor := b1001.FlatBorderColor;
  mjab.Font.Size := b1001.Font.Size;
  mjab.Font.Name := b1001.Font.Name;
  mjab.Font.Size := b1001.Font.Size;
  mjab.Height := b1001.Height;
  mjab.HotColor := b1001.HotColor;
  mjab.Left := b1001.Left;
  mjab.PopupMenu := b1001.PopupMenu;
  mjab.Top := b1001.Top;
  mjab.Width := b1001.Width;
  mjab.Tag := 1;
  mjab.Visible := b1001.Visible;
  mjab.ShowHint := b1001.ShowHint;
  mjab.OnMouseDown := p1001MouseDown;
  mjab.OnMouseMove := p1001MouseMove;
  mjab.OnMouseUp := p1001MouseUp;
  mjab.OnClick := p1001Click;
  mjab.OnContextPopup := p1001ContextPopup;
  mjarn := tjanhexbutton.create(self);
  mjarn.Parent := self;
  mjarn.Name := 'b2'+inttostr(mnumero);
  mjarn.Align := b2001.Align;
  mjarn.Caption := b2001.Caption;
  mjarn.Color := b2001.Color;
  mjarn.Enabled := b2001.Enabled;
  mjarn.Flat := b2001.Flat;
  mjarn.FlatBorderColor := b2001.FlatBorderColor;
  mjarn.Font.Size := b2001.Font.Size;
  mjarn.Font.Name := b2001.Font.Name;
  mjarn.Font.Size := b2001.Font.Size;
  mjarn.Height := b2001.Height;
  mjarn.HotColor := b2001.HotColor;
  mjarn.Left := b2001.Left;
  mjarn.PopupMenu := b2001.PopupMenu;
  mjarn.Top := b2001.Top;
  mjarn.Width := b2001.Width;
  mjarn.Tag := 1;
  mjarn.Visible := b2001.Visible;
  mjarn.ShowHint := b2001.ShowHint;
  mjarn.OnMouseDown := p1001MouseDown;
  mjarn.OnMouseMove := p1001MouseMove;
  mjarn.OnMouseUp := p1001MouseUp;
  mjarn.OnClick := p1001Click;
  mjarn.OnContextPopup := p1001ContextPopup;
  mjeb := tjanarrowrbutton.create(self);
  mjeb.Parent := self;
  mjeb.Name := 'b3'+inttostr(mnumero);
  mjeb.Align := b3001.Align;
  mjeb.Caption := b3001.Caption;
  mjeb.Color := b3001.Color;
  mjeb.Enabled := b3001.Enabled;
  mjeb.Flat := b3001.Flat;
  mjeb.FlatArrow := b3001.FlatArrow;
  mjeb.FlatBorderColor := b3001.FlatBorderColor;
  mjeb.Font.Size := b3001.Font.Size;
  mjeb.Font.Name := b3001.Font.Name;
  mjeb.Font.Size := b3001.Font.Size;
  mjeb.Height := b3001.Height;
  mjeb.HotColor := b3001.HotColor;
  mjeb.Left := b3001.Left;
  mjeb.PopupMenu := b3001.PopupMenu;
  mjeb.Top := b3001.Top;
  mjeb.Width := b3001.Width;
  mjeb.Tag := 1;
  mjeb.Visible := b3001.Visible;
  mjeb.ShowHint := b3001.ShowHint;
  mjeb.OnMouseDown := p1001MouseDown;
  mjeb.OnMouseMove := p1001MouseMove;
  mjeb.OnMouseUp := p1001MouseUp;
  mjeb.OnClick := p1001Click;
  mjeb.OnContextPopup := p1001ContextPopup;
  mjarn2 := tjanhexbutton.create(self);
  mjarn2.Parent := self;
  mjarn2.Name := 'b4'+inttostr(mnumero);
  mjarn2.Align := b4001.Align;
  mjarn2.Caption := b4001.Caption;
  mjarn2.Color := b4001.Color;
  mjarn2.Enabled := b4001.Enabled;
  mjarn2.Flat := b4001.Flat;
  mjarn2.FlatBorderColor := b4001.FlatBorderColor;
  mjarn2.Font.Size := b4001.Font.Size;
  mjarn2.Font.Name := b4001.Font.Name;
  mjarn2.Font.Size := b4001.Font.Size;
  mjarn2.Height := b4001.Height;
  mjarn2.HotColor := b4001.HotColor;
  mjarn2.Left := b4001.Left;
  mjarn2.PopupMenu := b4001.PopupMenu;
  mjarn2.Top := b4001.Top;
  mjarn2.Width := b4001.Width;
  mjarn2.Tag := 1;
  mjarn2.Visible := b4001.Visible;
  mjarn2.ShowHint := b4001.ShowHint;
  mjarn2.OnMouseDown := p1001MouseDown;
  mjarn2.OnMouseMove := p1001MouseMove;
  mjarn2.OnMouseUp := p1001MouseUp;
  mjarn2.OnClick := p1001Click;
  mjarn2.OnContextPopup := p1001ContextPopup;
  crecom := mnumero;
end;
Responder Con Cita