zoukankan      html  css  js  c++  java
  • WPF 使用定时器

    WPF 使用定时器:
    <ProgressBar Height="10" HorizontalAlignment="Left" Margin="288,0,0,189" Name="progressBar1"

    VerticalAlignment="Bottom" Width="100" />
    后台:
     private void button1_Click(object sender, RoutedEventArgs e)
            {
                Window_Loaded2();
                
               
            }
            private void Window_Loaded2()
            {
                DispatcherTimer _mainTimer = new DispatcherTimer();
                _mainTimer.Interval = TimeSpan.FromSeconds(1);
                _mainTimer.Tick += new EventHandler(_mainTimer_Tick);
                _mainTimer.IsEnabled = true;
                //Timer tmr = new Timer();
                //tmr.Interval = 100;
                //tmr.Enabled = true;
                //tmr.Tick += new EventHandler(tmr_Tick);
                
            }
            void _mainTimer_Tick(object sender, EventArgs e)
            {
                if (progressBar1.Value == progressBar1.Maximum)
                    progressBar1.Value = 0;

                progressBar1.Value++;
            }
    private void tmr_Tick(object sender, EventArgs e)
            {
                if (progressBar1.Value == progressBar1.Maximum) progressBar1.Value = 0;

                progressBar1.Value++;
            }

  • 相关阅读:
    Python内置函数(67)——zip
    Python内置函数(66)——vars
    Python内置函数(65)——type
    Python内置函数(64)——tuple
    Python内置函数(63)——super
    Python内置函数(62)——sum
    Python内置函数(61)——str
    Python内置函数(60)——staticmethod
    Hadoop初体验(续)--YARN
    Hadoop初体验
  • 原文地址:https://www.cnblogs.com/zhaoliang831214/p/3532256.html
Copyright © 2011-2022 走看看