此代码是不是为我工作的德尔福XE:鼠标悬停在窗体上吗?
http://delphi.about.com/cs/adptips2000/a/bltip0800_5.htm
procedure TForm1.FormDeactivate(Sender: TObject) ;
begin
ReleaseCapture;
end;
procedure TForm1.FormMouseMove
(Sender: TObject; Shift: TShiftState; X,Y: Integer) ;
begin
If GetCapture = 0 then
SetCapture(Form1.Handle) ;
if PtInRect(Rect(Form1.Left,
Form1.Top,
Form1.Left + Form1.Width,
Form1.Top + Form1.Height),
ClientToScreen(Point(x, y))) then
Form1.Caption := 'Mouse is over form' else
Form1.Caption := 'Mouse is outside of form';
end;
没有错误 - 它只是没有任何效果。
请帮忙。
编辑1
原来,这个问题是不是与代码,甚至是鼠标FormMouseEnter和FormMouseLeave不工作,因为我传递的形式我这样的功能创造了一个单位:
程序Slide(Form:TForm; Show:Boolean);
我从这个过程中调用Show方法。我怎样才能克服这个问题?
谢谢。
EDIT 2
我不想用我现在张贴的功能。我想使用下面提到的人们(FormMouseEnter和FormMouseLeave),但它在我的情况下也不起作用。
什么问题? – miku 2010-12-14 10:37:45
面向未来:尝试从链接中包含尽可能多的信息到您的问题中,以便其他人不必通过链接浏览以便能够回答问题。 – jpfollenius 2010-12-14 10:44:47
是不是形式标题改变,同时移动鼠标进出窗体,其工作正常对我来说 – Bharat 2010-12-14 10:51:35