WPF DispatcherTimer

来源:互联网 时间:1970-01-01

using System.Windows.Threading;DispatcherTimertm = newDispatcherTimer();
        publicWindow1()      
        {
            InitializeComponent();
           tm.Tick +=newEventHandler(tm_Tick);      
           tm.Interval = TimeSpan.FromSeconds(0.05);
          tm.Start();
        }
        
        private voidWindow_Loaded(objectsender, RoutedEventArgse)
       {
            textBox1.Text = progressBar1.Maximum.ToString();
            textBox2.Text = progressBar1.Minimum.ToString();     
        }

       void tm_Tick(objectsender, EventArgse)
      {
            progressBar1.Value++;
            textBox3.Text = progressBar1.Value.ToString();
            if(progressBar1.Value==progressBar1.Maximum)
            {
                tm.Stop();
            }          
        }

本文来自shenjianzong的博客,原文地址:http://hi.baidu.com/shenjianzong/blog/item/8fc0f6335c326e280b55a925.html


相关阅读:
Top