unit Unit6;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Mask, ComCtrls;
type
TForm6 = class(TForm)
StatusBar1: TStatusBar;
MaskEdit1: TMaskEdit;
Label1: TLabel;
Button1: TButton;
Timer1: TTimer;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Timer1Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure StatusBar1DrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel;
const Rect: TRect);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
Fprog:TProgressbar;
DrawRect:TRect;
public
{ Public declarations }
end;
var
Form6: TForm6;
implementation
{$R *.dfm}
procedure TForm6.FormCreate(Sender: TObject);
begin
Fprog:=TProgressbar.Create(Form6);
end;
procedure TForm6.StatusBar1DrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel;
const Rect: TRect);
begin
DrawRect:=rect;
end;
procedure TForm6.Button1Click(Sender: TObject);
begin
with Fprog do
begin
top:=DrawRect.Top;
left:=DrawRect.Left;
=DrawRect.Right-DrawRect.Left;
height:=DrawRect.Bottom-DrawRect.Top;
Visible:=true;
parent:=StatusBar1;
Smooth:=true;
end;
Fprog.Min:=0;
Fprog.Max:=100;
Fprog.Visible:=true;
Fprog.Position:=0;
//Fprog.Brush.Color:=clBlue;
Timer1.Interval:=StrToInt(Trim(MaskEdit1.Text));
StatusBar1.Panels.Items[1].Width:=150;
StatusBar1.Repaint;
Timer1.Enabled:=true;
end;
procedure TForm6.Timer1Timer(Sender: TObject);
begin
if Fprog.Position<100 then
begin
Fprog.Position:=Fprog.Position+1;
Fprog.Repaint;
end
else
begin
Timer1.Enabled:=false;
ShowMessage('ok');
end;
end;
procedure TForm6.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Fprog.Free;
end;
end.
//第一段的Style 设为 psOwnerDraw即可显示进度信息