Unit1.~pas
资源名称:jindutiao.rar [点击查看]
上传用户:hy6789
上传日期:2021-02-22
资源大小:164k
文件大小:1k
源码类别:
状态条
开发平台:
Delphi
- unit Unit1;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, ComCtrls, StdCtrls, ExtCtrls;
- type
- TForm1 = class(TForm)
- ProgressBar1: TProgressBar;
- Button1: TButton;
- Button2: TButton;
- Button3: TButton;
- procedure Button1Click(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure Button2Click(Sender: TObject);
- procedure Button3Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- n:integer;
- s:integer;
- implementation
- {$R *.dfm}
- procedure TForm1.Button1Click(Sender: TObject);
- var
- i:integer;
- begin
- form1.ProgressBar1.Position:=0;
- form1.ProgressBar1.Step:=1;
- for i:=1 to 100000 do
- form1.ProgressBar1.StepIt;
- end;
- procedure TForm1.FormCreate(Sender: TObject);
- var
- count:integer;
- begin
- n:=110000;
- s:=0;
- count:=100000;
- progressbar1.Min:=1;
- progressbar1.Max:=count;
- //SetWindowLong(ProgressBar1.Handle,GWL_EXSTYLE,
- //GetWindowLong(ProgressBar1.Handle,GWL_EXSTYLE)and(not WS_EX_STATICEDGE));{去掉progressbar的边框}
- // 设置progressbar的背景颜色
- Progressbar1.Brush.Color := cllime;
- // 设置progressbar的进度条颜色
- PostMessage(ProgressBar1.Handle, $0409, 0, clred);
- end;
- procedure TForm1.Button2Click(Sender: TObject);
- begin
- n:=n - 10000;
- ProgressBar1.Position:=n;
- end;
- procedure TForm1.Button3Click(Sender: TObject);
- begin
- s:=s + 10000;
- ProgressBar1.Position:=s;
- end;
- end.