⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 progressthread.pas

📁 县级供电企业电费核算源码, 在客户处正常运行8年以上, Delphi 5开发,数据库为Interbase/Firebird, 深入使用Procedure和Trigger等, 对入门者具有很好的参考价值
💻 PAS
字号:
unit ProgressThread;

interface

uses
  Classes,ComCtrls;

type
  TProgressThread = class(TThread)
  private
    { Private declarations }
	ProgressBar: TProgressBar;
  protected
    procedure Execute; override;
  public
  	Times: Integer;//进度条走过的次数;
	constructor Create(iProgressBar: TProgressBar;CreateSuspended: Boolean);
  end;

implementation

uses
	Windows,CommSMDLJF;
{ Important: Methods and properties of objects in VCL can only be used in a
  method called using Synchronize, for example,

      Synchronize(UpdateCaption);

  and UpdateCaption could look like,

    procedure ProgressThread.UpdateCaption;
    begin
      Form1.Caption := 'Updated in a thread';
    end; }

{ ProgressThread }

constructor TProgressThread.Create(iProgressBar: TProgressBar; CreateSuspended: Boolean);
Begin
	Inherited Create(Suspended);
	ProgressBar := iProgressBar;
    Times := 0;
End;

procedure TProgressThread.Execute;
begin
  { Place thread code here }
    ProgressBar.Max := 100;
	While Not Terminated Do
	Begin
    	if(ProgressBar.Position >= 100) Then
        Begin
        	ProgressBar.Position := 0;
            Inc(Times);
        End;
		ProgressBar.StepBy(ProgressBarStep);
        Sleep(50);
	End;
end;


end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -