新手小白虚心请教
我做的程序是.NET 3.5的自动下载。在显示进度的时候,不显示百分比
程序代码: private void RedirectForm_Shown(object sender, EventArgs e)
{
BackgroundWorker bg = new BackgroundWorker();
bg.RunWorkerAsync(param);//这里得到Dism指令
string oupread = null;
bg.DoWork += new DoWorkEventHandler((s, arg) =>
{
Process p = new Process();
p.StartInfo.FileName = @"C:\Windows\System32\Dism.exe";/
p.StartInfo.Arguments = (string)arg.Argument;
p.StartInfo.UseShellExecute = false;//
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
while (!p.HasExited)
{
oupread = p.StandardOutput.ReadLine();
if (oupread != null)
{
RedirectTB.Text += oupread + "\r\n";
p.WaitForExit(1000);
}
}
oupread = p.StandardOutput.ReadToEnd();
RedirectTB.Text += oupread + "\r\n";
p.Close();
p.Dispose();
});我是通过重定向 一行一行接受后显示在TextBox里 但是显示百分比的那一行,后台虽然在执行 但不显示。求解!拜托了









不懂,这是在搞啥呢?
版主真强