{
OnActiveFormChange, ActiveForm example
This example uses a two forms with a button on the first form. When the user clicks the button, the second form appears. As the user switches between forms, the form that is active is colored aqua.
} 
type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    procedure ColorForm(Sender: TObject);
  end;
var
  Form1: TForm1;
implementation
{$R *.xfm}
uses Unit2;
procedure TForm1.ColorForm(Sender: TObject);
begin
  Color := clWhite;
  Form2.Color := clWhite;
  Screen.ActiveForm.Color := clAqua;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
  Screen.OnActiveFormChange := ColorForm;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
  Form2.Show;
end; 
