在窗体上置控件speedbutton和panel,怎样实现将鼠标移上speedbutton时panel显示,鼠标离开speedbutton时panel隐藏? 要求:只能在speedbutton的mosemove事件上写代码!

解决方案 »

  1.   

    做不到!这里处理CM_MOUSELEAVE,CM_MOUSEENTERhttp://expert.csdn.net/Expert/topic/1347/1347722.xml
    http://expert.csdn.net/Expert/topic/1115/1115293.xml如果不想创建新控件,还可以用Application.OnMessage,改变Object.WindowProc指向的消息处理过程,窗体子类化等方式实现
      

  2.   

    if (x>3) and (x<speedbutton1.ClientRect.BottomRight.x-3) and (y>3)and (y<speedbutton1.ClientRect.BottomRight.y-3)  then
      panel1.Visible:=true
    else
      panel1.Visible:=false;
    其中减3是为了给cpu更多的响应时间