新增1個TButoon、1個TProgressBar及1個TStatusBar
事件加入FormCreate及OnDrawPanel
procedure TForm1.Button1Click(Sender: TObject);
var
i : integer;
begin
ProgressBar1.Position := 0;
ProgressBar1.Max := 100;
for i := 0 to 100 do
begin
ProgressBar1.Position := i;
Sleep(25);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
ProgressBarStyle : integer;
begin
//將狀態列的第二塊面板設為的自繪(即psOwnerDraw)
StatusBar1.Panels[1].Style := psOwnerDraw;
//將進程條放入狀態列
ProgressBar1.Parent := StatusBar1;
//去除狀態列的邊框,這樣就與狀態列溶為一體了
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
progressbar1.BoundsRect:=rect;
end;
沒有留言:
張貼留言