procedure TForm5.SpeedButton6MouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
begin
//   speedbutton6.Font.Color:=rgb(255,0,0);
 end;
以上的語句可以暑標移上去時字變顏色,可是如果暑標移開的話如何把字的顏色變回來呀

解决方案 »

  1.   

    在你的form的onmousemove里写程序不就行了?
      

  2.   

    响应消息CM_MOUSEENTER、CM_MOUSELEAVE。
    放在派生出来的新控件里响应,Button自身里不提供
      

  3.   

    如果还是不懂....给你个简单的办法吧....
    还在mousemove事件里....
    当x,y的值等于button的边缘的时候,把颜色变回去....
    就是x=0 or x=width or y=0 or y=height....
      

  4.   

    标准的做法是继承TSpeedButton,给他添加OnMouseEnter,OnMouseLeave事件,然后你可以在新控件的新事件里处理你的问题投机的做法1
    if (x<=1) or (x>=(sender as tspeedbutton).Width -2) or (y<=1) or (y>=(sender as tspeedbutton).Height  -2)
    then speedbutton1.Font.Color:=clgreen
    else speedbutton1.Font.Color:=rgb(255,0,0);
    但不太灵,鼠标要移的慢才能有效投机的做法2
    TLabel控件有MouseEnter,MouseLeave事件,可以放一个Label盖在SpeedButton上,大小稍小点  其他自己调整  显示统一,点击事件之类的都要注意
      

  5.   

    http://expert.csdn.net/Expert/topic/1151/1151295.xml
    http://expert.csdn.net/Expert/topic/1021/1021357.xml
      

  6.   

    也許我太笨,還是不會。我用的是SpeedButton這控制。我就是要他移到它上面它就變顏色,不在它上面就還原。。
    小弟初學,沒辦法,這麼多朋友提意見還是不太懂。
      

  7.   

    ehom(?!) 大俠!!!!!
    這裡的CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
    每一個CM都要用我的SpeedButton按鈕名稱去代嗎。
      

  8.   

    http://expert.csdn.net/Expert/topic/1347/1347722.xml
    http://expert.csdn.net/Expert/topic/1115/1115293.xml