似乎在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)