打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
如何用弹出窗口显示进度

问题来源: http://www.cnblogs.com/del/archive/2010/01/08/1642072.html#1820853

准备工作: 在空白窗体上添加 Button 和 Timer, 并分别激活它们的默认事件.

unit Unit1;interfaceuses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,  Dialogs, ExtCtrls, StdCtrls;type  TForm1 = class(TForm)    Button1: TButton;    Timer1: TTimer;    procedure Button1Click(Sender: TObject);    procedure Timer1Timer(Sender: TObject);  end;var  Form1: TForm1;implementation{$R *.dfm}uses Gauges;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 := poDesktopCenter;    Gauge1 := TGauge.Create(frm);    Gauge1.MinValue := 0;    Gauge1.MaxValue := 100;    Gauge1.Width := frm.ClientWidth - 40;    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 := 1end;end;end.

运行效果图:


本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Delphi捕捉DLL执行所抛出的异常。
Delphi 7 中的随机函数
delphi制作登陆窗体
[转]xe6 android 使用距离传感器(Proximiry)
Delphi的图形处理(一)
delphi多线程编程
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服