0
DirectoryInfo dirInfo = new DirectoryInfo(strSource);
FileInfo[] files = dirInfo.GetFiles();
pgb.Maximum = files.Length-1;
Thread thread = new Thread(new ThreadStart(() =>
{
for (int n = 0; n < files.Length; n++)
{
FileInfo tempfile = files[n];
string path = System.IO.Path.Combine(strDestination, tempfile.Name);
tempfile.CopyTo(path, true);
pgb.Dispatcher.BeginInvoke(new Action<int>((x) => pgb.Value = x),
DispatcherPriority.Background, n);
}
}));
thread.Start();
我想表明複製的文件的進度條,其中的標籤上的百分比:
percent = n/pgb.Maximum
誰能幫助我?謝謝!
您可以通過文本塊結合到進度條值即 –
auburg
我可以在代碼後面執行它嗎?在xalm中不使用綁定 – cptJack44
@ cptJack44可以在代碼後面執行任何操作 – AnjumSKhan