Ver Mensaje Individual
  #1  
Antiguo 14-04-2010
ioco ioco is offline
Miembro
 
Registrado: ene 2010
Posts: 42
Reputación: 0
ioco Va por buen camino
ProgressBar en StatusBar

Hola, estaba chafardeando un ejemplo de delphiabout que mencionan en otro post de esta misma sección y no entiendo porqué me da el resultado que me da... las instrucciones son bastantes sencillas y encima dan el código ya hecho y todo, pero no encuentro qué puede fallar

Les subo el código tal cual lo puse (copy-paste de la web misma, añadiendo la unit de windows al uses ya que no estaba por defecto):
Código Delphi [-]
procedure TForm1.FormCreate(Sender: TObject);
var
  ProgressBarStyle: integer;
begin
  //enable status bar 2nd Panel custom drawing
  StatusBar1.Panels[1].Style := psOwnerDraw;

  //place the progress bar into the status bar
  ProgressBar1.Parent := StatusBar1;

  //remove progress bar border
  ProgressBarStyle := GetWindowLong(ProgressBar1.Handle,
                                    GWL_EXSTYLE);
  ProgressBarStyle := ProgressBarStyle
                      - WS_EX_STATICEDGE;
  SetWindowLong(ProgressBar1.Handle,
                GWL_EXSTYLE,
                ProgressBarStyle);
end;

procedure TForm1.StatusBar1DrawPanel(StatusBar: TStatusBar;
  Panel: TStatusPanel; const Rect: TRect);
begin
  if Panel = StatusBar.Panels[1] then
  with ProgressBar1 do begin
    Top := Rect.Top;
    Left := Rect.Left;
    Width := Rect.Right - Rect.Left - 15;
    Height := Rect.Bottom - Rect.Top;
  end;
end;
y el resultado mostrando el form en edición (izquierda) y en ejecución (derecha):



Se supone que con eso basta para mostrar la progressbar en el segundo panel de la statusbar, ¿no?

Gracias de antemano como siempre por su tiempo

Última edición por ioco fecha: 14-04-2010 a las 16:03:12.
Responder Con Cita