zoukankan      html  css  js  c++  java
  • 如何用弹出窗口显示进度

    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, ExtCtrls, StdCtrls, Gauges;
    
    type
      TForm1 = class(TForm)
        Button1: TButton;
        Timer1: TTimer;
        procedure Button1Click(Sender: TObject);
        procedure Timer1Timer(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    var
      Gauge1: TGauge;
    
    procedure TForm1.Button1Click(Sender: TObject);
    var
      Frm : TForm;
    begin
      Frm := TForm.Create(Nil);
      Frm.BorderStyle := bsSizeToolWin;
      Frm.Width := 300;
      Frm.Height := 80;
      Frm.Position := poScreenCenter;
    
      Gauge1 := TGauge.Create(Frm);
      Gauge1.MinValue := 0 ;
      Gauge1.MaxValue := 100 ;
      Gauge1.Width := frm.ClientWidth - 40;
      Gauge1.Height := 30;
      Gauge1.Height := 20;
      Gauge1.Left := 20;
      Gauge1.Top := (frm.ClientHeight - Gauge1.Height) div 2;
      Gauge1.Parent := frm;
    
      Timer1.Interval := 100;
      Timer1.Enabled := True;
      frm.ShowModal;
      frm.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;  //Gauge1所在的窗体关闭
      end;
    
    end;
    
    end.
    
    
  • 相关阅读:
    XML文件详解以及解析
    Delphi 泛型详解
    Delphi 修改本地日期和时间
    java -> this关键字
    java ->super关键字
    Java -> 构造器(构造方法)
    java -> 方法的重载
    java面向对象->多态
    Java面向对象->接口
    Java面向对象->抽象类
  • 原文地址:https://www.cnblogs.com/beeone/p/1791160.html
Copyright © 2011-2022 走看看