d7 里的image没有enter和leava的方法。。如何添加

解决方案 »

  1.   

    捕捉enter和leave的消息:private
      procedure MouseEnter(var Msg: TMessage); message cm_mouseenter;
      procedure MouseLeave(var Msg: TMessage); message cm_mouseleave;procedure TForm1.MouseEnter(var Msg:TMessage);
    begin
      if TObject(Msg.LParam) is TImage then
      begin
        if TImage(Msg.LParam).Name='Image1' then
           ....
      end;
    end;procedure TForm1.MouseLeave(var Msg:TMessage);
    begin
      if TObject(Msg.LParam) is TImage   then
      begin
        if TImage(Msg.LParam).Name='Image1' then
           ...
      end;
    end;