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; 更改游标的位置重新写数字

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-24
猜你喜欢
  • 2022-02-26
  • 2021-12-15
  • 2021-12-05
  • 2022-12-23
  • 2021-11-02
  • 2022-12-23
相关资源
相似解决方案