C#编程,后台使用另一进程来管理控件的一种写法~

版权声明:我不生产代码,我只是代码的搬运工。 https://blog.csdn.net/qq_43307934/article/details/86524477

后台代码: 

此处只是一个临时写下的样式,直接复制无法运行。主要是分享这种格式。

            Thread thread = new Thread(new ThreadStart(() =>
            {
                for (int i = 1; i <= 100; i++)
                {
                    pb.Dispatcher.Invoke(new MethodInvoker(() => pb.Value = i));
                    tb.Dispatcher.Invoke(new MethodInvoker(() => tb.Text = i + "%"));
                    Thread.Sleep(200);
                }
            }));
            thread.Start();
     

猜你喜欢

转载自blog.csdn.net/qq_43307934/article/details/86524477
今日推荐