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

📄 unit2.pas

📁 Delphi简单多线程实例
💻 PAS
字号:
unit Unit2;

interface

uses
  Windows, Messages, SysUtils,Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Unit1;

type
  mymath1 = class(TThread)
  private
    { Private declarations }
  protected
    procedure Execute; override;
  public      //手工添加
    constructor create;   //手工添加
  end;

implementation

{ 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 mymath1.UpdateCaption;
    begin
      Form1.Caption := 'Updated in a thread';
    end; }

{ mymath1 }

constructor mymath1.create;   //手动添加
begin
  inherited create(true);
end;

procedure mymath1.Execute;
var
   i : integer;
begin
  { Place thread code here }
  form1.RzProgressBar1.Percent := 0;

   for i := 1 to 100 do
     begin
       form1.RzProgressBar1.Percent := form1.RzProgressBar1.Percent + 1;
       Sleep(50);
     end;
end;

end.
 

⌨️ 快捷键说明

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