Código
{ Public declarations }
ComponentePro: TComponent;
procedure AlteraCor(Sender: TObject);
//Altera a cor do componente selecionado
procedure TForm1.AlteraCor(Sender: TObject);
begin
if Assigned(ComponentePro) then
TEdit(ComponentePro).Color := $00F5E0D8;
if (Screen.ActiveControl is TEdit) or //Se a tela tiver outro tipo de componente é só inserir aqui
(Screen.ActiveControl is TComboBox) then //Ex.:(Screen.ActiveControl is TCheckBox) or
begin // (Screen.ActiveControl is TRadioGroup) or
TEdit(ActiveControl).Color := $00DDFFFF; // (Screen.ActiveControl is TMemo)
ComponentePro := ActiveControl;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
//Chama a procedure para alterar a cor do componente selecionado
Screen.OnActiveControlChange := AlteraCor;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
Screen.OnActiveControlChange := nil;
end;
Planeta Delphi - www.planetadelphi.com.br - Todos os direitos reservados | Copyright 2001-2009