W
waxing
Unregistered / Unconfirmed
GUEST, unregistred user!
窗体上放一个Panel1和Button1 用下面代码可以拦截到鼠标移动到控件上的消息
private
procedure wndproc(var msg:Tmessage);override ;
procedure TMainAdoform.wndproc(var msg: Tmessage);
begin
if msg.LParam = longint(Panel1) then
begin
if (msg.Msg = cm_mouseenter) then
showmessage('鼠标已经到在Panel1上');
end;
if msg.LParam = longint(Button1) then
begin
if (msg.Msg = cm_mouseenter) then
showmessage('鼠标已经到在Button1上');
end;
inherited wndproc(msg) ;
end;
当我把Button1不直接放在窗体上而放在Panel1中下面代码只能拦截到Panel1。不能拦截到
Button1上。拦截过程应该如何写?[red]才能拦截到放在Panel1中的Button1[/red]鼠标移动消息?
private
procedure wndproc(var msg:Tmessage);override ;
procedure TMainAdoform.wndproc(var msg: Tmessage);
begin
if msg.LParam = longint(Panel1) then
begin
if (msg.Msg = cm_mouseenter) then
showmessage('鼠标已经到在Panel1上');
end;
if msg.LParam = longint(Button1) then
begin
if (msg.Msg = cm_mouseenter) then
showmessage('鼠标已经到在Button1上');
end;
inherited wndproc(msg) ;
end;
private
procedure wndproc(var msg:Tmessage);override ;
procedure TMainAdoform.wndproc(var msg: Tmessage);
begin
if msg.LParam = longint(Panel1) then
begin
if (msg.Msg = cm_mouseenter) then
showmessage('鼠标已经到在Panel1上');
end;
if msg.LParam = longint(Button1) then
begin
if (msg.Msg = cm_mouseenter) then
showmessage('鼠标已经到在Button1上');
end;
inherited wndproc(msg) ;
end;
当我把Button1不直接放在窗体上而放在Panel1中下面代码只能拦截到Panel1。不能拦截到
Button1上。拦截过程应该如何写?[red]才能拦截到放在Panel1中的Button1[/red]鼠标移动消息?
private
procedure wndproc(var msg:Tmessage);override ;
procedure TMainAdoform.wndproc(var msg: Tmessage);
begin
if msg.LParam = longint(Panel1) then
begin
if (msg.Msg = cm_mouseenter) then
showmessage('鼠标已经到在Panel1上');
end;
if msg.LParam = longint(Button1) then
begin
if (msg.Msg = cm_mouseenter) then
showmessage('鼠标已经到在Button1上');
end;
inherited wndproc(msg) ;
end;