CM_MOUSEENTER
マウスの出入りメッセージを検出しようとしていますCM_MOUSELEAVE
が、それをキャッチしていません。ここで何が間違っていますか?
type
TMyControl = class(TCustomControl)
private
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST;
end;
procedure TMyControl.CMMouseEnter(var Message: TMessage);
begin
//Handle mouse entering
//Breakpoint never reached, procedure never called
end;
procedure TMyControl.CMMouseLeave(var Message: TMessage);
begin
//Handle mouse leaving
//Breakpoint never reached, procedure never called
end;
procedure TMyControl.WMNCHitTest(var Message: TWMNCHitTest);
var
Ch: Bool;
begin
if csDesigning in ComponentState then
Message.Result := HTCLIENT
else begin
Ch:= False;
//Do checks and pass `Ch:= True;` if something changed...
if Ch then Invalidate;
end;
end;