![]() |
ProgressBar, Shape ... in einer Statusbar einbinden?
Ich habe hier von den Schweizern folgenden Code mit dem man eine Progressbar und andere VCL Komponenten in eine Statusbar einbinden kann:
Delphi-Quellcode:
Statt Progressbar1 kann da auch Shape1 ... stehen.
uses
CommCtrl; type THackControl = class(TControl); procedure TForm1.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; Mfg Tobi |
Re: ProgressBar, Shape ... in einer Statusbar einbinden?
Warum eine extra Komponente von TControl ableiten?
Desweiteren kann es sein, das jemand die Breite einzelner Panels der StatusBar an die Breite der Form anpassen will. Deshalb im OnResize-Event die Größe z.B. der ProgressBar an Größe des Panels anpassen. Mein Vorschlag:
Delphi-Quellcode:
Ansonsten ein super Code :thumb:
procedure TForm1.FormCreate(Sender: TObject);
begin // Place progressbar on the statusbar ProgressBar1.Parent := StatusBar1; end; procedure TForm1.FormResize(Sender: TObject); var PanelRect: TRect; begin // Retreive the rectancle of the statuspanel (0 für das erste Panel, 1 für das zweite usw.) SendMessage(StatusBar1.Handle, SB_GETRECT, 0, Integer(@PanelRect)); // Position the progressbar over the panel on the statusbar with PanelRect do ProgressBar1.SetBounds(Left, Top, Right-Left, Bottom-Top); end; Man kann sogar ein TImage oder jede andere Komponente so auf eine StatusBar setzen... |
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:48 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz