C# 定时器

delegate void mydelete(); 

DispatcherTimer dTimer = new System.Windows.Threading.DispatcherTimer();
            dTimer.Tick += new EventHandler(dTimer_Tick);
            dTimer.Interval = new TimeSpan(0, 0, 0, 1, 0);
            dTimer.Start();

 

void dTimer_Tick(object sender, EventArgs e)
        {
            try
            {
                mydelete dele = new mydelete(MoveShip);
                dele.Invoke();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

posted @ 2015-04-29 10:33  赤月奇  阅读(199)  评论(0编辑  收藏  举报