小编Rod*_*ber的帖子

进度条值与在Windows 7中呈现的内容不同步

似乎在Windows 7中,在设置进度条的值时会发生一些动画.设置值似乎不等待动画完成.有没有办法通知进度条何时完成动画?

我有一个示例程序.请参阅评论.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Threading;

namespace Testing
{
   static class Program
   {
      [STAThread]
      static void Main()
      {
         Application.EnableVisualStyles();
         Application.SetCompatibleTextRenderingDefault(false);
         var form = new Form1();
         form.Run();
      }
   }

   public partial class Form1 : Form
   {
      public Form1()
      {
         InitializeComponent();
      }

      public void Run()
      {
         Thread thread = new Thread
         (
            delegate()
            {
               ProgressBarMax = 10;
               ProgressValue = 0;

               for (int i = 0; i < 10; i++)
               {
                  Thread.Sleep(1000);
                  ProgressValue++;
               }
            }
         ); …
Run Code Online (Sandbox Code Playgroud)

c# winforms progress-bar

1
推荐指数
1
解决办法
5466
查看次数

标签 统计

c# ×1

progress-bar ×1

winforms ×1