在消息窗口中显示进度条
来源:互联网 发布:c语言中swap的用法 编辑:程序博客网 时间:2024/06/10 17:23
动态创建消息窗口,并在窗口中显示一个进度条,在进度条范围内选择按钮
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure DialogTimer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
AMsgDialog: TForm;
AProgressBar: TProgressBar;
ATimer: TTimer;
begin
AMsgDialog := CreateMessageDialog('Quickly! Answer Yes or No!', mtWarning, [mbYes, mbNo]);
AProgressBar := TProgressBar.Create(AMsgDialog);
ATimer := TTimer.Create(AMsgDialog);
with AMsgDialog do
try
Tag := 10; //seconds!
Caption := 'You have 10 seconds';
Height := 150;
with AProgressBar do begin
Name := 'Progress';
Parent := AMsgDialog;
Max := AMsgDialog.Tag; //seconds
Step := 1;
Top := 95;
Left := 8;
Width := AMsgDialog.ClientWidth - 16;
end;
with ATimer do
begin
Interval := 1000;
OnTimer := DialogTimer;
end;
case ShowModal of
ID_YES: ShowMessage('Answered "Yes".');
ID_NO: ShowMessage('Answered "No".');
ID_CANCEL: ShowMessage('Time up!')
end; //case
finally
ATimer.OnTimer := nil;
Free;
end;
end;
procedure TForm1.DialogTimer(Sender: TObject);
var
aPB: TProgressBar;
begin
if not (Sender is TTimer) then Exit;
if ((Sender as TTimer).Owner) is TForm then
with ((Sender as TTimer).Owner) as TForm do
begin
aPB := TProgressBar(FindComponent('Progress'));
if aPB.Position >= aPB.Max then
ModalResult := mrNo
else
aPB.StepIt;
end;
end;
end.
- 在消息窗口中显示进度条
- 在DBGridEh中显示进度条
- 在ASP.NET中显示进度条
- 在ASP.NET中显示进度条
- 在ASP.NET中显示进度条
- 在ASP.NET中显示进度条
- 在ASP.NET中显示进度条
- 在ASP.NET中显示进度条
- 在Asp.Net中显示进度条
- 在ASP.NET中显示进度条
- 在ASP.NET中显示进度条
- 在Asp.Net中显示进度条
- 在ASP.NET中显示进度条
- 在Android的Notification中显示进度条
- 在Android的Notification中显示进度条
- 在Android的Notification中显示进度条
- 在Android的Notification中显示进度条
- 如何在UIAlertView中显示进度条
- 面试算法题1
- 向大家分享
- 求.NET网上购物网站+设计说明书的。谢谢了!~!~!!~!
- 写一个服务程序的模板
- 开始→运行→输入的命令集锦
- 在消息窗口中显示进度条
- 代码在线烧录注意的一点
- Java 多线程编程之一 进程与线程,并发和并行的区别:吃馒头的比喻
- combobox和listbox的文字可以右对齐显示
- 五种JSP跳转方式比较
- delphi的资源文件
- pos、ansipos、fillchar在delphi2010中unicode的问题
- 博弈问题及SG函数(真的很经典)
- .NET正则基础之——正则委托