unit ELButton;
interface
uses StdCtrls, classes, Messages, controls, ExtCtrls;
type
TELButton =
class(TButton)
private
FOnMouseEnter: TNotifyEvent;
FOnMouseLeave: TNotifyEvent;
procedure CMMouseEnter(
var Msg: TMessage);
message CM_MOUSEENTER;
procedure CMMouseLeave(
var Msg: TMessage);
message CM_MOUSELEAVE;
published
property OnMouseEnter: TNotifyEvent
read FOnMouseEnter
write FOnMouseEnter;
property OnMouseLeave: TNotifyEvent
read FOnMouseLeave
write FOnMouseLeave;
end;
TELImage =
class(TImage)
private
FOnMouseEnter: TNotifyEvent;
FOnMouseLeave: TNotifyEvent;
procedure CMMouseEnter(
var Msg: TMessage);
message CM_MOUSEENTER;
procedure CMMouseLeave(
var Msg: TMessage);
message CM_MOUSELEAVE;
published
property OnMouseEnter: TNotifyEvent
read FOnMouseEnter
write FOnMouseEnter;
property OnMouseLeave: TNotifyEvent
read FOnMouseLeave
write FOnMouseLeave;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('
ESFEB', [TELButton, TELImage]);
end;
procedure TELButton.CMMouseEnter(
var Msg: TMessage);
begin
if Enabled
and Assigned(fOnMouseEnter)
then fOnMouseEnter(Self);
end;
procedure TELButton.CMMouseLeave(
var Msg: TMessage);
begin
if Enabled
and Assigned(fOnMouseLeave)
then fOnMouseLeave(Self);
end;
procedure TELImage.CMMouseEnter(
var Msg: TMessage);
begin
if Enabled
and Assigned(fOnMouseEnter)
then fOnMouseEnter(Self);
end;
procedure TELImage.CMMouseLeave(
var Msg: TMessage);
begin
if Enabled
and Assigned(fOnMouseLeave)
then fOnMouseLeave(Self);
end;
end.