for (j = 3; j > 0; j--)
{
this.timerup.Start();
} private void timerup_Tick(object sender, EventArgs e)
{
this.ElevatorStyleLeft.Location = new Point(ElevatorStyleLeft.Location.X, ElevatorStyleLeft.Location.Y - 80);
this.timerup.Stop();
}为什么timer只执行了一次,怎样才能执行3次
{
this.timerup.Start();
} private void timerup_Tick(object sender, EventArgs e)
{
this.ElevatorStyleLeft.Location = new Point(ElevatorStyleLeft.Location.X, ElevatorStyleLeft.Location.Y - 80);
this.timerup.Stop();
}为什么timer只执行了一次,怎样才能执行3次
解决方案 »
- 编程高手请进——用C#搭建消息框
- 谁用VS2005+C#写程序 写过皮肤文件,有实例可以共享一下,让学习下
- c#开启进程问题???
- MM美工50分问个问题! 我要怎么设置才能让做的网页不受屏幕分辨率的影响.
- [群12634167]开发人员关于C#、VB和VBScrip的技术群(群内气氛较为活跃,喜静者勿加)
- 大家都用什么配置管理工具啊,VSS6.0太恶心了
- 静态成员初始化之后什么时候会释放?是在程序完全结束后被释放吗?与全局变量有什么不同?
- GDI+的高手请进啊
- 创建类时用get{}是干什么啊?
- c#新手疑问——什么是事件访问器?下面代码作用是什么?--再线等待
- 如何让几个线程同时访问一个集合里面的元素?
- textBox文本框输入值后如何自动将值添加到datagridview中
{
this.ElevatorStyleLeft.Location = new }
换成timerup_Tick(null,null);
if(count>3)
{
this.ElevatorStyleLeft.Location = new Point(ElevatorStyleLeft.Location.X, ElevatorStyleLeft.Location.Y - 80);
}else{
this.timerup.Stop();
}
{
this.ElevatorStyleLeft.Location = new Point(ElevatorStyleLeft.Location.X, ElevatorStyleLeft.Location.Y - 80);
this.timerup.Stop();//执行计时器的Stop()方法后,计时器将停止工作。
}
不然你的timer执行一次以后就自动停止了。在你的事件处理函数里面计数,超过3次才调用timer.stop。其余时候不调用。
if(i>=3)
{
timer.Stop();
}