Type TMain = class(TForm)
....
protected Procedure LastFocus(var Mess : TMessage) ; message WM_ACTIVATE;
End;
//--------------------------------------------------------------
Procedure TMain.LastFocus(var Mess : TMessage) ;
Begin
IF Mess.wParam = WA_INACTIVE
Then PanelCaption.Color:=clInactiveCaption
Else PanelCaption.Color:=clActiveCaption;
Inherited;
End;
Источник: Дельфи. Вокруг да около.