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

📄 unit2.pas

📁 delphi开发的抄表数据管理系统
💻 PAS
字号:
unit Unit2;

interface

uses
  windows,
  Forms,
  Dialogs,
  Classes;

type
  MyThread = class(TThread)
  private
    { Private declarations }
  protected
    procedure Execute; override;
  public
    procedure exit; 
  end;
var
  flg:boolean;
implementation

uses Unit1;

{ Important: Methods and properties of objects in visual components can only be
  used in a method called using Synchronize, for example,

      Synchronize(UpdateCaption);

  and UpdateCaption could look like,

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

{ MyThread }

procedure MyThread.Execute;
begin
  flg:=true;
  Form1.ProgressBar1.Min:=0;
  Form1.ProgressBar1.Max:=99;
  Form1.ProgressBar1.Position:=0;
  while(flg) do
  begin
    sleep(10);
    begin
      Application.ProcessMessages;
      Form1.ProgressBar1.Position:=Form1.ProgressBar1.Position+1;
      if Form1.ProgressBar1.Position=99 then
        Form1.ProgressBar1.Position:=0;
    end;
  end;
end;

procedure MyThread.exit;
begin
  flg:=false;
end;

end.
 

⌨️ 快捷键说明

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