界面定义:
<ProgressBar Name="bar" Height="15" DockPanel.Dock="Bottom"></ProgressBar>
线程中调用的方法:
void export_ChangeProgress()
{
try{
object[] dd = { 34 }; //定义的委托 调用
changeProgressHandler = new ChangeProgress(ChangeBar);
bar.Dispatcher.BeginInvoke(changeProgressHandler, dd);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
委托定义:
private delegate void ChangeProgress(double dd);
ChangeProgress changeProgressHandler;赋值
private void ChangeBar(double dd)
{
bar.Value = dd;
}