📄 unit2.pas
字号:
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm2 = class(TForm)
RadioButton1: TRadioButton;
Shape1: TShape;
RadioButton2: TRadioButton;
Shape2: TShape;
RadioButton3: TRadioButton;
Shape3: TShape;
Button1: TButton;
Button2: TButton;
Label1: TLabel;
Shape4: TShape;
Label2: TLabel;
Label3: TLabel;
Button3: TButton;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.Button2Click(Sender: TObject);
begin
close;
end;
procedure TForm2.Button1Click(Sender: TObject);
begin
form2.RadioButton1.Enabled :=true;
form2.RadioButton2.Enabled :=true;
form2.RadioButton3.Enabled :=true;
Shape4.Shape:=stRectangle;
Shape4.Brush.Color:=clWhite;
Label2.Caption:='空闲' ;
Label3.Caption:= '' ;
end;
procedure TForm2.Button3Click(Sender: TObject);
begin
if form2.RadioButton1.Enabled=false
then Label3.Caption:='临界资源被1占用,请等待完成!' ;
if form2.RadioButton2.Enabled=false
then Label3.Caption:='临界资源被2占用,请等待完成!' ;
if form2.RadioButton3.Enabled=false
then Label3.Caption:='临界资源被3占用,请等待完成!' ;
if form2.RadioButton1.Checked
then begin
if form2.RadioButton2.Enabled=true and form2.RadioButton3.Enabled=true
then begin Shape4.Shape:=stCircle;
Shape4.Brush.Color:=clRed;
Label2.Caption:='临界资源被进程1占用';
form2.RadioButton1.Enabled:=false;
//form2.RadioButton2.Enabled:=true;
//form2.RadioButton3.Enabled:=true;
end;
end;
if form2.RadioButton2.Checked
then begin
if form2.RadioButton1.Enabled=true and form2.RadioButton3.Enabled=true
then begin Shape4.Shape:=stCircle;
shape4.Brush.Color:=clBlack;
Label2.Caption:='临界资源被进程2占用';
form2.RadioButton2.Enabled:=false;
// form2.RadioButton1.Enabled:=true;
// form2.RadioButton3.Enabled:=true;
end;
end;
if form2.RadioButton3.Checked
then begin
if form2.RadioButton1.Enabled=true and form2.RadioButton2.Enabled=true
then begin
Shape4.Shape:=stCircle;
Shape4.Brush.Color:=clBlue;
Label2.Caption:='临界资源被进程3占用';
form2.RadioButton3.Enabled:=false;
//form2.RadioButton1.Enabled:=true;
//form2.RadioButton2.Enabled:=true;
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -