ioco
14-04-2010, 16:00:06
Hola, estaba chafardeando un ejemplo de delphiabout (http://delphi.about.com/library/weekly/aa030805a.htm) 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 :confused:
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):
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):
http://img707.imageshack.us/img707/710/progstatus.jpg
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 :)
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):
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):
http://img707.imageshack.us/img707/710/progstatus.jpg
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 :)