📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Label1: TLabel;
Label2: TLabel;
procedure FormCreate(Sender: TObject);
procedure Label2Click(Sender: TObject);
private
{ Private declarations }
public
procedure ShiftToAnother(Sender: TObject);
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.DFM}
procedure TForm1.ShiftToAnother(Sender: TObject);
var
I : Integer;
begin
for I:= 0 to Screen.ActiveForm.ControlCount -1 do
if Screen.ActiveForm.Controls[I] is TWinControl then
if Screen.ActiveForm.Controls[I]= Screen.ActiveControl then
begin
(Screen.ActiveForm.Controls[I] as TEdit).Color := clRed;
if Screen.ActiveForm is TForm1 then
( Screen.ActiveForm as TForm1).Label1.Caption
:= Screen.ActiveControl.Name+' Actives'
else if Screen.ActiveForm is TForm2 then
( Screen.ActiveForm as TForm2).Label1.Caption
:= Screen.ActiveControl.Name+' Actives';
end
else
(Screen.ActiveForm.Controls[I] as TEdit).Color := clAqua;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Screen.OnActiveControlChange := ShiftToAnother;
end;
procedure TForm1.Label2Click(Sender: TObject);
begin
Form2.Show;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -