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

📄 unit4.pas

📁 一个交通红绿灯线程
💻 PAS
字号:
unit Unit4;

interface

uses
  Classes, SysUtils, Graphics, Dialogs;

type
  Tstop = class(TThread)
  private
    { Private declarations }
  protected
    procedure Execute; override;
  end;

implementation
uses main, Unit1, Unit2;
{ Tstop }

procedure Tstop.Execute;
var
  fl, ff: boolean;
begin
  fl := false;
  ff := false;
  while not terminated do
  begin
    {卡车停车限制}
    if Form1.shape1.Brush.Color = clRed then
      if ((Form1.Image3.Top >= 110) and (Form1.Image3.Top <= 180)) then
      begin
        thread.Free;
        thread := Tthread1.Create(true);
        fl := true;
      end;
    if (Form1.shape1.Brush.Color = clLime) and (fl = true) then
    begin
      thread.Resume;
      fl := false;
    end;



    {小车停车限制}
    if Form1.Shape2.Brush.Color = clRed then
      if ((Form1.image2.Left > 307) and (Form1.image2.Left <= 355)) then
      begin
        thread2.Free;
        thread2 := Tthread2.Create(true);
        ff := true;
      end;
    if (Form1.Shape2.Brush.Color = clLime) and (ff = true) then
    begin
      thread2.Resume;
      ff := false;
    end;




  end;
end;

end.

⌨️ 快捷键说明

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