was ist neu ¦  programmier tips ¦  indy artikel ¦  intraweb artikel ¦  informationen ¦  links ¦  interviews
 sonstiges ¦  tutorials ¦  Add&Win Gewinnspiel

Tips (1541)

Dateien (137)
Datenbanken (90)
Drucken (35)
Grafik (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Mathematik (76)
Multimedia (45)
Oberfläche (107)
Objekte/
ActiveX (51)

OpenTools API (3)
Sonstiges (126)
Strings (83)
System (266)
VCL (242)

Tips sortiert nach
Komponente


Tip suchen

Tip hinzufügen

Add&Win Gewinnspiel

Werbung

40 Visitors Online


 
...eine ProgressBar in der Statuszeile einblenden?
Autor: Ronald Hoek
Homepage: http://www.componentago.nl
[ Tip ausdrucken ]  

Tip Bewertung (30):  
     




{ -----------------------------------------------------------------------

What I wanted was a TProgressBar component sitting on a TStatusBarPanel.
The problem is, that TStatusPanel isn't a panel at all, thus not having
a handle to use SetParent.

Basicly I do this.
- Place a TProgressBar and a TStatusBar on the form
- Put the code as show below in the OnCreate event of the form
- And voila, you've got a fully functional progressbar exactly where I wanted it

I've create a THackControl to acces the TControl.SetParent procedure.
With it I can easelly place the Progressbar in the Statusbar.

NOTE:
If you resize the panels on the progressbar, you need to re-execute
the last 2 line of code in the example, to reposition the progressbar.

Hope you like it :)

Ronald
hoek@componentagro.nl

-------------------------------------------------------------------------- }

type
  
THackControl = class(TControl);

procedure TfrmWebsite.FormCreate(Sender: TObject);
var
  
PanelRect: TRect;
begin
  
// Place progressbar on the statusbar
  
THackControl(ProgressBar1).SetParent(StatusBar1);
  // Retreive the rectancle of the statuspanel (in my case the second)
  
SendMessage(StatusBar1.Handle, SB_GETRECT, 1, Integer(@PanelRect));
  // Position the progressbar over the panel on the statusbar
  
with PanelRect do
    
ProgressBar1.SetBounds(Left, Top, Right - Left, Bottom - Top);
end;


 

Bewerten Sie diesen Tipp:

dürftig
ausgezeichnet


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners