参考了别人写得进度条列子,做了一下封装: class ConProgressbar { private const int FullBarLength = 22; private const int FullProgress = 100; // 背景色 private ConsoleColor m_ColorBack; // 前景色 private ConsoleColor m_ColorFore; // 当前光标所在位置(行) private int m_CurRow = 0; // 当前光标所在位置(列) private int m_CurCol = 0; /// <summary> /// 初始化 /// </summary> public ConProgressbar() { this.m_ColorBack = Console.BackgroundColor; this.m_ColorFore = Console.ForegroundColor; this.m_CurRow = 0; this.m_CurCol = 0; } /// <summary> /// 绘制进度开始 /// </summary> /// <param name="p_StartInfo"> 起始信息</param> public void Start(string p_StartInfo) { // 换行 if (0 != Console.CursorLeft) { Console.WriteLine(); } //第一行信息 Console.WriteLine(p_StartInfo); this.m_CurRow = Console.CursorTop; this.m_CurCol = Console.CursorLeft; //第二行绘制进度条背景 Console.BackgroundColor = ConsoleColor.DarkCyan; for (int i = 0; ++i <= FullBarLength; ) { Console.Write(" "); } Console.WriteLine(" "); Console.BackgroundColor = this.m_ColorBack; //第三行输出进度 Console.WriteLine("0%"); } /// <summary> /// 绘制进度条进度 /// </summary> /// <param name="p_CurProgress">0~100</param> public void ReportProgress(int p_CurProgress, string p_ProgressInfo) { //设置进度条颜色 Console.BackgroundColor = ConsoleColor.Yellow; //设置光标位置,参数为第几列和第几行 Console.SetCursorPosition((int)((float)p_CurProgress / (float)FullProgress * FullBarLength), this.m_CurRow); //移动进度条 Console.Write(" "); //恢复背景色 Console.BackgroundColor = this.m_ColorBack; //更新进度百分比,原理同上. Console.ForegroundColor = ConsoleColor.Green; Console.SetCursorPosition(0, this.m_CurRow + 1); Console.Write("{0}% {1}", p_CurProgress, p_ProgressInfo); Console.ForegroundColor = this.m_ColorFore; } /// <summary> /// 绘制进度结束 /// </summary> public void End(string p_EndInfo) { Console.SetCursorPosition(0, this.m_CurRow + 2); Console.WriteLine(p_EndInfo); } } 应用: ConProgressbar conProgBar = new ConProgressbar(); conProgBar.Start("Now Start..."); for (int i = 0; i <= 10000; ++i) { int realProgress = (int)((float)i / (float)10000 * 100); conProgBar.ReportProgress(realProgress, i.ToString()); } conProgBar.End("Now End...");