Einzelnen Beitrag anzeigen

paresy

Registriert seit: 24. Aug 2004
Ort: Lübeck
105 Beiträge
 
Delphi 2007 Professional
 
#4

Re: transparente Progressbar oder Text in Progressbar

  Alt 27. Dez 2004, 19:28
wenn du schon nen TRect hast kannst doch die progressbar direkt darein zeichnen ohne den umweg über das TImage zu machen

EDIT.... habs mal für die statusbar umgeschrieben

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  R, RBar : TRect;
  Position: Integer;
  Text: String;
begin

    Position := 33;
    Text := '333kb/1000kb @ 33,12kb/s';

    Statusbar1.Perform(SB_GETRECT, 0, Integer(@R));

    //progress bar
    RBar := R;

    //fit into panel
    RBar.Left := RBar.Left + 1;
    RBar.Top := RBar.Top + 1;
    RBar.Right := RBar.Right - 2;
    RBar.Bottom := RBar.Bottom - 2;

    RBar.Right := RBar.Left + Ceil( (Position / 100) * (RBar.Right - RBar.Left) );

    Statusbar1.Canvas.Brush.Color := clSkyBlue;
    Statusbar1.Canvas.FillRect(RBar);

    //progress text
    SetBkMode(Statusbar1.Canvas.Handle, TRANSPARENT);
    DrawText(Statusbar1.Canvas.Handle,
             PCHAR(Text),
             Length(Text),
             R,
             DT_SINGLELINE or DT_END_ELLIPSIS or DT_CENTER);


end;
der part mit "fit into panel" könnte man bestimmt über ne api herausfinden.... aber dafür gibts andere spezialisten.... mir fällt die funktion grad nicht ein...

grüße, paresy
  Mit Zitat antworten Zitat