利用IS 操作副可轻松搞定。
IF SENDER IS TButton then
  With (Sender As TButton ) do
    begin
    {do somthing};
    end;

解决方案 »

  1.   

    1。鼠标进入可由MOUSMOVE得到
    2. 鼠标离开没有消息,但父窗口会得到消息,可在父窗口的MOUSEMOVE消息处理中处理;另外,也可以做一个定时器,在鼠标移入控件时启动定时器,每个一段较短的时间就检查鼠标是否在控件上,如果没有则说明鼠标移出了
      

  2.   

    扩展你的TControl类让所有组件继承于你的扩展类就可以了
    如果需要的话可以给你一段VC的例子
      

  3.   

    我要DELPHI的代码,QIUJOE可以吗?
      

  4.   

    简单的例子:
    从Tlabel继承,加一个focuscolor属性。
    用了鼠标进入和离开两个消息。unit HxLabel;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls;type
      THxLabel = class(TLabel)
      private
        FFcolor:Tcolor;
        FoldColor:Tcolor;
        { Private declarations }
      protected
        { Protected declarations }
      public
        { Public declarations }
         procedure CMMSENTER(var Msg: TMessage);message CM_MOUSEENTER;
         procedure CMMSLEAVE(var Msg: TMessage);message CM_MOUSELEAVE;
      published
         property FocusColor:Tcolor read FFcolor write FFcolor;
        { Published declarations }
      end;procedure Register;implementationprocedure Register;
    begin
      RegisterComponents('Hxsoft', [THxLabel]);
    end;procedure THxlabel.CMMSENTER(var Msg: TMessage);
    begin
    //鼠标进入
      Foldcolor:=self.font.Color;
      self.Font.Color:= FFcolor;
    end;procedure THxlabel.CMMSLEAVE(var Msg: TMessage);
    begin
    //鼠标离开
      self.font.Color:=Foldcolor;
    end;end.
      

  5.   

    將其他控件的ONMOUSEMOVE都對應在同一個PROCEDURE中
    然後用IS來判斷SENDER是何控件, 完了用AS進行轉換后再對其FONT.COLOR進行賦值
      

  6.   

    fancy的方法比较好,而且简单。这就是vb中控件数组的扩展。多掌握这样的概念,在很多地方都用得到,甚至不一定是控见的问题。
      

  7.   

    我平时用的一个笨办法,先给一个组件写好处理程序,
    IF SENDER IS TButton then
    With (Sender As TButton ) do
    begin
     font.color:=/////
    end;
    然后其他需要的组件把OnMouseMove指定为这个过程就行了。
      

  8.   

    1、自己写一个组件,不过我有现成的;
    2、WM_MOUSEHOVER和WM_MOUSELEAVE两条消息用过没有?希望对你有所帮助。
      

  9.   

    捕捉窗口(application.message)的WM_MOUSEHOVER和WM_MOUSELEAVE两条消息,然后用is 判断