mouseleave事件里开一个线程,或用一个timer来控制过一段时间后让他不可见.

解决方案 »

  1.   

    private void button1_MouseLeave(object sender, System.EventArgs e)
    {
    System.Threading.Thread t=new System.Threading.Thread(new System.Threading.ThreadStart(this.CloseButton));
    t.Start();
    }
    private void CloseButton()
    {
    System.Threading.Thread.Sleep(2000);
    this.button1.Visible=false;}
      

  2.   

    使用如上Timmer很消耗资源可以再MouseLeave事件中来一个大循环,逐渐隐藏(带点动画),时间大约1妙中
      

  3.   

    用hbxtlhx的方法,运用线程的方法;
    private void button1_MouseLeave(object sender, System.EventArgs e)
    {
    System.Threading.Thread t=new System.Threading.Thread(new System.Threading.ThreadStart(this.CloseButton));
    t.Start();
    }
    private void CloseButton()
    {
    System.Threading.Thread.Sleep(2000);//只停留时间
    this.button1.Visible=false;}
      

  4.   

    如果是的话,请参考一下代码:
    <input id=TextToHide type=text value="I am here"><br>
    <input id=btnTime type=button value="Hide Text" onclick="toHideText()">
    <script language=javascript>
    var timerId;
    function toHideText()
    {
    timerId = window.setTimeout("hideText()",3000);
    }
    function hideText()
    {
    document.all.TextToHide.style.display = "none";
    window.clearTimeout(timerId);
    }
    </script>