您的位置:首页 > 编程语言 > Delphi

delphi7 TGauge Tprogressbar 简单应用

2016-09-30 11:21 267 查看
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, Gauges;

type
TForm1 = class(TForm)
pbCount100: TProgressBar; //在Win32标签页
Button1: TButton;
gCount100: TGauge;//在Samples标签页

procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
pbCount100.Max := 100; //max值
pbCount100.Smooth :=true;//进度条的显示的更加平滑
pbCount100.Step :=1;//步长

// gCount100.BorderStyle := bsSingle;
gCount100.MaxValue :=100;
gCount100.BackColor := TColor($00ff00);//进度条的背景色     绿
gCount100.ForeColor :=  TColor($0000ff);//进度条颜色        红
end;

procedure TForm1.Button1Click(Sender: TObject);
var
i : Integer;
begin
for i:= 1 to 100 do
begin
pbCount100.Position :=  pbCount100.Position + 1; //TprogressBar 进度条位置 position
gCount100.Progress :=  gCount100.Progress + 1; //TGauge 进度条位置 Progress
// Application.ProcessMessages;
Sleep(10);
end;
end;

end.

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: