在我使用的方法描述here放置在Delphi上TStatusBar一個TProgressBar過去:(?最近的Windows更新後)方法不再起作用
procedure TForm1.FormCreate(Sender: TObject);
var
ProgressBarStyle: integer;
begin
//enable status bar 2nd Panel custom drawing
StatusBar1.Panels[1].Style := psOwnerDraw;
//place the progress bar into the status bar
ProgressBar1.Parent := StatusBar1;
//remove progress bar border
ProgressBarStyle := GetWindowLong(ProgressBar1.Handle, GWL_EXSTYLE);
ProgressBarStyle := ProgressBarStyle - WS_EX_STATICEDGE;
SetWindowLong(ProgressBar1.Handle, GWL_EXSTYLE, ProgressBarStyle);
end;
procedure TForm1.StatusBar1DrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel;
const Rect: TRect);
begin
if Panel = StatusBar.Panels[1] then
with ProgressBar1 do
begin
Top := Rect.Top;
Left := Rect.Left;
Width := Rect.Right - Rect.Left;
Height := Rect.Bottom - Rect.Top;
end;
end;
但這不再有效,即舊方案仍按預期工作,但新編制的方案不會。我在Windows 10上使用了相同的Delphi版本XE8。
這是否意味着此方法不合適?什麼是正確的方法來做到這一點?
這是在上面創建一個窗口控件來顯示這樣的進展。我一直都是通過直接在面板中繪製進度來完成的。簡單的FillRect調用,或者如果過程是風格化/主題化的,則使用風格/主題API。 –
有道理,我會嘗試。 (關於一般的進度條,不能這麼說嗎?)但是你不知道我的代碼突然不再工作了嗎?謝謝。 – stevenvh