如题??

解决方案 »

  1.   

    写个函数
    function IsInObj(Handle:HWND):boolean;
    var ms:TPOINT;wndRec:TRect;
    begin
      GetCursorPos(ms);
      GetWindowRect(Handle ,wndRec);
      Result:=(ms.X >wndRec.Left) and (ms.X <wndRec.Right)
            and (ms.Y >wndRec.Top) and (ms.Y <wndRec.Bottom);
    end;然后再 Timer的OnTimer事件中用IsInObj监测鼠标是否在指定窗口中。
      

  2.   

    热炒热卖unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, FileCtrl;type
      TForm1 = class(TForm)
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
      type TYXFileListBox=Class(TFileListBox)
      private
        procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
        procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
      public
      end;
    var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
    var
      yxflb:TYXFileListBox;
    begin
      yxflb:=TYXFileListBox.create(self);
      yxflb.parent:=self
    end;{ YXFileListBox }procedure TYXFileListBox.CMMouseLeave(var Message: TMessage);
    begin
      Form1.Caption:='mouse move out YXFileListBox';
    end;
    procedure TYXFileListBox.CMMouseEnter(var Message: TMessage);
    begin
      Form1.Caption:='mouse move in YXFileListBox';
    end;end.
      

  3.   

    to: blucecat(灵魂正被delphi吞噬) 
    是可以了,但是它其它的事件怎么实现??
    比如双击,单击 等事件??
      

  4.   

    每个都可以用消息来实现
    但是太麻烦
    你完全可以自己作一个控件
    原理可以仿照其他带有onenter,ondbclick等事件的控件
      

  5.   

    呵呵
    自己作控件没什么难的
    做了第一个,你就会发现很简单
    看看TForm是怎么实现上面的功能的