//去除状态栏的边框,这样就与状态栏溶为一体了
ProgressBarStyle := GetWindowLong(ProgressBar1.Handle,GWL_EXSTYLE);
ProgressBarStyle := ProgressBarStyle - WS_EX_STATICEDGE;
SetWindowLong(ProgressBar1.Handle, GWL_EXSTYLE, ProgressBarStyle);
end;
2.//编写状态栏的自绘代码
procedure TForm1.StatusBar1DrawPanel(StatusBar: TStatusBar;Panel: TStatusPanel;const Rect: TRect);
begin
//注意这里的Panels[1]指的就是第2块面板,因为默认是从0开始的
if Panel = StatusBar.Panels[1] then
with ProgressBar1 do begin
Top := Rect.Top;
Left := Rect.Left;
Width := Rect.Right - Rect.Left - 15;
Height := Rect.Bottom - Rect.Top;
end;
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/