Highlight componen

Posted in Components

Use CM_MOUSEENTER and CM_MOUSELEAVE messages:

  TYourObject = class(TAnyControl)
  ...
  private
    procedure CMMouseEnter(var AMsg: TMessage); message CM_MOUSEENTER;
    procedure CMMouseLeave(var AMsg: TMessage); message CM_MOUSELEAVE;
  ...
  end;

implementation

procedure TYourObject.CMMouseEnter(var AMsg: TMessage);
begin
  ParentColor:=False;
  Color:=clHighlightText;
end;

procedure TYourObject.CMMouseLeave(var AMsg: TMessage);
begin
  ParentColor:=True;
end;