Вставить ProgressBar в StatusBar

Материал из DRKB

Вставить ProgressBar в StatusBar[править | править код]

procedure TForm1.FormCreate(Sender: TObject);
begin
  with ProgressBar1 do
  begin
    Parent := StatusBar1;
    Position := 100;
    Top := 2;
    Left := 0;
    Height := StatusBar1.Height - Top;
    Width := StatusBar1.Panels[0].Width - Left;
  end;
end;


pgProgress положить на форму как Visible := false;

StatusPanel надо OwnerDraw сделать и рефрешить, если Position меняется.


procedure TMainForm.stStatusBarDrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel; const Rect: TRect);
begin
  if Panel.index = pnProgress then
  begin
    pgProgress.BoundsRect := Rect;
    pgProgress.PaintTo(stStatusBar.Canvas.Handle, Rect.Left, Rect.Top);
  end;
end;


Source: http://delphiworld.narod.ru/
ID: 00963