谢谢

解决方案 »

  1.   

    从TButton继承一个元件,添加一个事件,并捕获mouse的消息
      

  2.   

    我需要的是TButton的mouseout事件啊!
      

  3.   

    本人是个菜菜鸟,有个不正规的方法,嫌继承太麻烦,也不会
    上次看到一个显示hint的方法,变通一下来解决响应mouse进入进出button的问题,先设button1.hint:='button1'
    procedure ShowHint(Sender: TObject);procedure TForm1.FormCreate(Sender: TObject);
    begin
    //...
    Application.OnHint := ShowHint;
    //...
    end;procedure TForm1.ShowHint(Sender: TObject);
    begin
    if Application.Hint='button1' then
    begin
    showmessage('mouse is over button1');
    end
    end;
      

  4.   

    声明一个消息处理过程
    procedure CMMouseLeave(var Message: TMessage); message CM_MouseLeave;实现代码
    procedure TForm1.CMMouseLeave(var Message: TMessage);
    begin
      if TObject(Message.LParam) = Button1 then
        ShowMessage('鼠标离开了');
    end;
      

  5.   

    自己继承一个Button类,手动添加消息MouseOut,如同楼上,想要更清楚的解释,请参见:Delphi高级编程good luck!