BeginInvoke会重新开一个线程

 t = new Thread(new ThreadStart(delegate
            {
                Play(sender, e);
                Console.WriteLine("Play ended.");
            }));
            t.Start();
  private void Play(object sender, EventArgs e)
        {
            Console.WriteLine("InvokeRequired = " + InvokeRequired);
            if (InvokeRequired)
            {
                Invoke(new PlayDelegate(Play), sender, e);
                return;
            }
} 

这里应该使用 Invoke,避免使线程t死掉

posted @ 2013-03-28 15:12  louiskoo  阅读(375)  评论(0编辑  收藏  举报