using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace ConsoleApplication5
{
class Program
{
static void Main(string[] args)
{
Console.Write("Loading.....0%");
int leftPos = Console.CursorLeft - 2;
for (int i = 1; i <= 100; i++)
{
Console.CursorLeft = leftPos;
Console.Write("{0}%", i);
Thread.Sleep(500);
}
}
}
}
这段代码的关键就在于int leftPos = Console.CursorLeft - 2; 得游标的位置(-2是我们要修改的百分数我们要改两个位子)
和Console.CursorLeft = leftPos; 更改游标的位置重新写数字