Q
qddmh
Unregistered / Unconfirmed
GUEST, unregistred user!
我继承了TSpeedButton组件, 加了onMouseEnter 和 onMouseExit 事件,
但onMouseExit当鼠标离开本组件时, 此事件一直出发.(我用Showmessage测试的)
高手们指点指点
procedure TMYSpeedButton.CMMouseEnter(var Message: TMessage);
begin
if Assigned(FMouseEnter) then
FMouseEnter(self);
// Perform(CM_MOUSELEAVE, 0, 0);
inherited;
end;
procedure TMYSpeedButton.CMMouseLeave(var Message: TMessage);
begin
if Assigned(FMouseExit) then
FMouseExit(self);
inherited;
end;
constructor TMYSpeedButton.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
SetBounds(0, 0, 60, 60);
end;
但onMouseExit当鼠标离开本组件时, 此事件一直出发.(我用Showmessage测试的)
高手们指点指点
procedure TMYSpeedButton.CMMouseEnter(var Message: TMessage);
begin
if Assigned(FMouseEnter) then
FMouseEnter(self);
// Perform(CM_MOUSELEAVE, 0, 0);
inherited;
end;
procedure TMYSpeedButton.CMMouseLeave(var Message: TMessage);
begin
if Assigned(FMouseExit) then
FMouseExit(self);
inherited;
end;
constructor TMYSpeedButton.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
SetBounds(0, 0, 60, 60);
end;