|
<ProgressBar Grid.Row="10" Grid.Column="0" Grid.ColumnSpan="2" Margin="4,2,4,4" IsIndeterminate="False" Height="20" x:Name="prgStats"/>
Thread thread = new Thread(new ThreadStart(() =>
{
for (int i = 0; i <= 100; i++)
{
this.Dispatcher.BeginInvoke((ThreadStart)delegate { this.prgStats.Value = i; }); //progressBar1是进度条控件的名字。
Thread.Sleep(100);
}
}));
thread.Start(); 分析这段代码的优缺点 |
|