2018-09-28 从1加到10000 progressbar

unit Unit3;

interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs,system.json,Vcl.StdCtrls,
IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP,
Vcl.ComCtrls;

type
TForm3 = class(TForm)
Button1: TButton;
Label1: TLabel;
ProgressBar1: TProgressBar;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form3: TForm3;

implementation

{$R *.dfm}

procedure TForm3.Button1Click(Sender: TObject);
var
a,b:integer;
begin
b:=0;
progressbar1.max:=10000;
progressbar1.Position:=1;
for a := 1 to 10000 do
begin
application.ProcessMessages;
b:=b+a;
progressbar1.Position:=a;
label1.Caption:= inttostr(a);
end;
showmessage(inttostr(b));
//从1加到10000
end;

end.

你可能感兴趣的:(2018-09-28 从1加到10000 progressbar)