日期:2014-05-17  浏览次数:21106 次

卡住了,关于进度条的,请大神指点
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using System.Diagnostics;

namespace ccc
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {


            Process mycmd = new Process();
            mycmd.StartInfo.FileName = "cmd.exe"; //设置程序名称
            mycmd.StartInfo.Arguments = "/c" + " dir /b /s /ad " + "\"" + xph.Text;
            mycmd.StartInfo.UseShellExecute = false; //关闭SHELL的使用
            mycmd.StartInfo.CreateNoWindow = true;     //关闭窗口
            mycmd.StartInfo.RedirectStandardInput = true; //获取或设置一个值,该值指示应用程序的输入是否从 Process.StandardInput 流中读取
            mycmd.StartInfo.RedirectStandardOutput = true; //获取或设置一个值,该值指示是否将应用程序的输出写入 Process.StandardOutput 流中。
            mycmd.StartInfo.RedirectStandardError = true; //获取或设置一个值,该值指示是否将应用程序的错误输出写入 Process.StandardError 流中。
            mycmd.Start();
            this.jieguo.Text = mycmd.StandardOutput.ReadToEnd();
            mycmd.Close();

        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.fph.ShowDialog();