在speedbutton的onMouseMove中写代码就行了。

解决方案 »

  1.   

    SpeedButtom.Glyph.Loadfromfile('c:\aa.bmp');放在 MouseMove事件里,  当鼠标移动到它上方时改为aa.bmp这样是可以的,  但移走时原来的图片怎样回来呢,  它没有移走事件,  怎样实现,  谢了 
      

  2.   

    procedure TForm1.SpeedButton1MouseMove(Sender: TObject; Shift: TShiftState;
      X, Y: Integer);
    begin
            speedbutton1.Glyph:=image1.Picture.Bitmap;
    end;
    不过有闪动。 :(
      

  3.   

    procedure TForm1.SpeedButton1MouseMove(Sender: TObject; Shift: TShiftState;
      X, Y: Integer);
    begin
    speedbutton1.Glyph.LoadFromFile('c:\test1.bmp');
    end;procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    begin
    speedbutton1.Glyph.LoadFromFile('c:\test2.bmp');
    end;
      

  4.   

    可以在Button后面的Form的MouseMove事件里面把图片在Load回来~~
      

  5.   

    其实不一定是form,就是在包含这个speedbutton的容器中的onmousemove中load一下图片就可以了
      

  6.   

    可以这样:
     如SpeedButton是放在form1上,在form1 的MouseMove事件里再把原来的图片放回来.
      

  7.   

    那你设置个变量
    var isIn:boolean;procedure TForm1.SpeedButton1MouseMove(Sender: TObject; Shift: TShiftState;
      X, Y: Integer);
    begin
           if Not isIn then   
           speedbutton1.Glyph:=image1.Picture.Bitmap;
           isIn:=True;
    end;记得鼠标移动到别的地方的时候把isIn设置为False
      

  8.   

    实现下面两个消息的处理方法,就行啦。  CM_MOUSEENTER
      CM_MOUSELEAVE
      

  9.   

    思路是这样的:
    用Tspeedbutton的tag作为判断条件。鼠标在按钮上 speedbutton 的 tag  为 0时 执行 tag:=1 和换图  ,鼠标在 form上是 判断 speedbutton1 的tag 为1 执行 tag:=0 和换图 
    这样就只执行一次了。不会闪
      

  10.   

    可以是可以,能不能用CM_MOUSELEAVE
      

  11.   

    这样不,能不能用CM_MOUSELEAVE,万分感谢
      

  12.   

    http://www.csdn.net/expert/Topic/262/262125.shtm你看看老大的回答阿!!
      

  13.   

    老大,我用的是SpeendButton1,  怎样把   
         procedure MouseEnter(var Msg:TMessage); message cm_mouseEnter;
        procedure MouseLeave(var Msg:TMessage); message cm_mouseLeave;  
    加到它的事件里头
      

  14.   

    老大~~~那个帖子只不过是Bitbtn~~~TLCActiveBitBtn = class(TBitBtn)你修改为
    TLCActiveSbtn = class(TSpeedButton)不行吗??
      

  15.   

    老大!!!!!
    我不会改嘛, 能不能改一下原来的SpeedButton1,  再通过install Component安装一下呢
      

  16.   

    不行呀,我做了一个, 看不到MoseLeave属于和MouseEnter属性
      

  17.   

    tikkypeng(千两狂死郎) 老大,你快帮我解决呀!要不然
      

  18.   

    我把新建了一个form , 存名为ActiveBitBtn,把它的所有代码复制过来了
    然后改了它的
    TLCActiveBitBtn = class(TBitBtn)为   TLCActiveBitBtn = class(TBitBtn)
    再把procedure TLCActiveBitBtn.MouseEnter(var Msg:TMessage);
    begin
      Font.Style:=Font.Style+[fsBold]+[fsUnderline];
      Font.Size:=Font.Size+2;
      Font.Color:=clBlue;
    end;procedure TLCActiveBitBtn.MouseLeave(var Msg:TMessage);
    begin
      Font.Style:=Font.Style-[fsBold]-[fsUnderline];
      Font.Size:=Font.Size-2;
      Font.Color:=clBackground;
    end;
    全都删了,剩下
    unit ActiveBitBtn;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls, Buttons;type
      TLCActiveBitBtn = class(TSpeenButton)
      private
        { Private declarations }
      protected
        { Protected declarations }
        procedure MouseEnter(var Msg:TMessage); message cm_mouseEnter;
        procedure MouseLeave(var Msg:TMessage); message cm_mouseLeave;
      public
        { Public declarations }
      published
        { Published declarations }
      end;procedure Register;implementationprocedure Register;
    begin
      RegisterComponents('LCC', [TLCActiveBitBtn]);
    end;
      

  19.   

    tikkypeng(千两狂死郎) 老大,你快帮我解决呀!  快点呀,看看哪儿出错了
      

  20.   

    你看看我的阿~~~~~
    unit PSSpeedButton;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      Buttons;type
      TPSSpeedButton = class(TSpeedButton)
      private
        FOnMouseLeave: TNotifyEvent;
        procedure WZMouseLeave(var Msg:TMessage); message CM_MOUSELEAVE;
        { Private declarations }
      protected
        { Protected declarations }
      public
        { Public declarations }
      published
        property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
        { Published declarations }
      end;procedure Register;implementationprocedure Register;
    begin
      RegisterComponents('PS', [TPSSpeedButton]);
    end;procedure TPSSpeedButton.WZMouseLeave(var Msg: TMessage);
    begin
        inherited;//继承父类
        if csLButtonDown in ControlState then
        begin
            Self.MouseUp(mbLeft,[ssLeft],0,0);
        end;
        if Assigned (FonMouseLeave) then FOnMouseLeave(Self);
        end;
    end.
      

  21.   

    这样是可以的,有MouseLeave属性,但没有MouseEnter; 可不可以加上MouseEnter属性
      

  22.   

    有东西学,tikkypeng(千两狂死郎):请问上面的代码怎样用呢?
      

  23.   

    那个是自己作的控件阿~~只不过是继承了TSpeedButton~~然后在此基础上~增加一个Mouse离开事件~~