📄 unit3.pas
字号:
unit Unit3;
interface
uses
Classes, SysUtils, Graphics, ExtCtrls;
type
Tthread3 = class(TThread)
private
tt: TShape;
f: boolean;
{ Private declarations }
protected
procedure Execute; override;
public
constructor Create(flag: Boolean; lamp: TShape; Ctrl: Boolean); overload;
end;
implementation
uses main;
{ Tthread3 }
constructor Tthread3.Create(flag: Boolean; lamp: TShape; Ctrl: Boolean);
begin
tt := lamp;
f := Ctrl;
Create(flag);
end;
{控制交通灯}
procedure Tthread3.Execute;
var
i: integer;
begin
for i := 1 to 5000 do
begin
if f = true then
begin
tt.Brush.Color := clRed;
f := false;
end
else if f = false then
begin
tt.Brush.Color := clLime;
f := true;
end;
sleep(5000);
end;
{ Place thread code here }
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -