在一个控件mouseleave事件后,过一会再隐藏这个控件,如何实现? mouseleave事件里开一个线程,或用一个timer来控制过一段时间后让他不可见. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 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;} 使用如上Timmer很消耗资源可以再MouseLeave事件中来一个大循环,逐渐隐藏(带点动画),时间大约1妙中 用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;} 如果是的话,请参考一下代码:<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> c#控制台程序中输入数字出错 关于c# winform 数据控件绑定的问题 如何制作winform安装程序 combobox 自动填充问题,请大家帮忙 关于数据库备份 删除数据库中重复记录 datagridview 排序后,怎么取消排序? javascript 调用winform后台方法的问题 请saucer(思归, MS .NET MVP)等大侠帮忙解答,谢谢! 接口——用途! 高分求解 .7数字 变成0.7数字的形式。 如果DataRow的RowState是DataRowState.Delete,那么该行的数据怎样才能访问?
{
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;}
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;}
<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>