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++;
            }

  • 相关阅读:
    中英切换
    vue-cli3 关闭一直运行的 /sockjs-node/info?t= ...
    vue 深拷贝
    C++ 中 typename
    将博客搬至CSDN
    死锁及处理
    C 运算符优先级
    阻塞与非阻塞,同步与异步
    同步函数与异步函数
    C 结构体位域
  • 原文地址:https://www.cnblogs.com/zhaoliang831214/p/3532256.html
Copyright © 2011-2022 走看看