玩过Linux都知道其终端的强悍,初次使用Linux终端确实被它的进度条给深深震撼了,后来详细研究下,发现原理其实也不难,于是自己动手在windows中写了个控制台的进度条类,现在和大家分享下
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Distance
{
class ConsoleProgressBar
{
/// <summary>
/// 构造一个指定的进度条
/// </summary>
/// <param name="foreGroundColor">进度条颜色</param>
/// <param name="posTop">行位置</param>
/// <param name="posLeft">列位置</param>
/// <param name="cellChar">单元格样式</param>
public ConsoleProgressBar(System.ConsoleColor foreGroundColor, int posTop, int posLeft,char cellChar)
{
ForegroundColor = foreGroundColor;
PositionTop = posTop;
PositionLeft = posLeft;
CellChar = cellChar;
}
/// <summary>
/// 构造一个默认的进度条
/// 其颜色为红色
/// 位置为