Einzelnen Beitrag anzeigen

nahpets
(Gast)

n/a Beiträge
 
#19

AW: Ich will die Sanduhr zurück!

  Alt 6. Feb 2017, 14:05
Ungetestet, da nur grob abgekupfert:
Delphi-Quellcode:
procedure SetProgressBarOnPanel(stb : TStatusBar; pb : TProgressBar; iPanelNo : Integer);
var
          PanelRect : TRect;
          ProgressBarStyle : LongInt;
begin
  if pb.Parent <> stb then pb.Parent := stb;
  ProgressBarStyle := GetWindowLong(pb.Handle, GWL_EXSTYLE);
  ProgressBarStyle := ProgressBarStyle - WS_EX_STATICEDGE;
  SetWindowLong(pb.Handle, GWL_EXSTYLE, ProgressBarStyle);
  SendMessage(stb.Handle, SB_GETRECT, iPanelNo, Integer(@PanelRect));
  pb.SetBounds(PanelRect.Left + 1,
               PanelRect.Top + 1,
               PanelRect.Right - PanelRect.Left - 2,
               PanelRect.Bottom - PanelRect.Top - 2);
end;
Damit müsste man eine Progressbar auf ein Panel einer Statusbar legen können, dabei gehe ich mal davon aus, dass die Statusbar mindestens 1 Panel hat.
Delphi-Quellcode:
type
  Tform1 = class(TForm)
    pb: TProgressBar;
    stb: TStatusBar;
...
// Im FormCreate oder so:
  SetProgressBarOnPanel(stb,pb,0);
  Mit Zitat antworten Zitat