在我使用的方法描述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