Delphi 动态生成进度条窗体


本文整理自网络,侵删。

 
在implementation加入下面

uses
  Gauges;
 var Gauge1: TGauge;
 
加入Timer1控件,设为false 
 
procedure TForm1.Button1Click(Sender: TObject);
var
  form2: TForm;
begin
  form2 := TForm.Create(nil);
  form2.BorderStyle := bsNone;
  form2.Width := 360;
  form2.Height := 30;
  form2.Position := poMainFormCenter;
  Gauge1 := TGauge.Create(form2);
  Gauge1.MinValue := 0;
  Gauge1.MaxValue := 100;
  Gauge1.Width := form2.ClientWidth - 2;
  Gauge1.Height := 30;
  Gauge1.Left := 10;
  Gauge1.Top := (form2.ClientHeight - Gauge1.Height) div 2;
  Gauge1.Parent := form2;
  Timer1.Interval := 100;
  Timer1.Enabled := True;
  form2.ShowModal;
  form2.Free;
  Timer1.Enabled := False;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  if Assigned(Gauge1) then
  begin
    Gauge1.Progress := Gauge1.Progress + 1;
    if Gauge1.Progress = Gauge1.MaxValue then
      TForm(Gauge1.Parent).ModalResult := 1;
  end;

end;

相关阅读 >>

Delphi 附加数据读取

Delphi中最小化其他程序及所有程序窗口最小化

Delphi 快速读取txt 指定行的数据

Delphi 老外分享的textfile高速遍历大数据文本

Delphi 反转字符串方法2

Delphi 软关闭显示器的代码

Delphi 模糊查询和字段查询

Delphi 减小程序的尺寸(关闭rtti反射机制)

Delphi 自动复制到指定目录的代码

Delphi 进程防杀之hook api法

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...