| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 6388 人关注过本帖
标题:请教Timer的Tick事件
取消只看楼主 加入收藏
yanhui387
Rank: 1
来 自:广东
等 级:新手上路
帖 子:48
专家分:0
注 册:2007-12-4
收藏
 问题点数:0 回复次数:3 
请教Timer的Tick事件
怎么将System.Windows.Forms.Timer的Tick事件以1毫秒以下的速度触发该事件呢?
或者 有没有其他方法可以以1毫秒以下的速度执行一次事件?
望各位朋友帮忙解答下我的疑问..
搜索更多相关主题的帖子: Tick Timer 
2008-11-23 19:56
yanhui387
Rank: 1
来 自:广东
等 级:新手上路
帖 子:48
专家分:0
注 册:2007-12-4
收藏
得分:0 
namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        System.Timers.Timer timer1;

        private void timer1_Elapsed(object sender, EventArgs e)
        {
            CheckForIllegalCrossThreadCalls = false;
            if (this.label1.Location.Y == 700)
            {
                this.label1.Location = new Point(100, 0);
                this.timer1.Enabled = false;
            }
            this.label1.Location = new Point(100, this.label1.Location.Y + 1);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            timer1 = new System.Timers.Timer(0.1);
            this.timer1 .Elapsed +=new System.Timers.ElapsedEventHandler(timer1_Elapsed);
            this.timer1.Enabled = true;
        }
    }
}

刚发现System.Timers的Interval属性可以设置1毫秒以下的值
但是感觉0.1毫秒触发timer1_Elapsed 跟1毫秒没区别..

[[it] 本帖最后由 yanhui387 于 2008-11-23 20:16 编辑 [/it]]
2008-11-23 20:08
yanhui387
Rank: 1
来 自:广东
等 级:新手上路
帖 子:48
专家分:0
注 册:2007-12-4
收藏
得分:0 
按你们这样说的话 那Interval属性设置0.1~1 都一样喽?
有没其他方法可以真正与1秒1000次以上的速度执行事件呢?
这个也该贴问题所在呀..求解..

我想把窗体的某控件高速移动``` 设置1毫秒的话
感觉跟乌龟跑差不多= =`` 如果几个timer同时触发该事件
虽然快了一些 但是速度到达一定程序的时候也被限制了
无奈``

[[it] 本帖最后由 yanhui387 于 2008-11-24 13:33 编辑 [/it]]
2008-11-24 13:28
yanhui387
Rank: 1
来 自:广东
等 级:新手上路
帖 子:48
专家分:0
注 册:2007-12-4
收藏
得分:0 
也只能这样了 谢谢各位提醒啦
2008-11-24 19:46
快速回复:请教Timer的Tick事件
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.012273 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved