如何在 C# 中更改控制台的 CursorSize?


要在 C# 中更改控制台的 CursorSize,可以使用 C# 中的 Console.CursorSize 属性。

示例

我们看一下示例 -

using System;
class Demo {
   public static void Main (string[] args) {
      Console.BackgroundColor = ConsoleColor.Blue;
      Console.WriteLine("Background color changed = "+Console.BackgroundColor);
      Console.ForegroundColor = ConsoleColor.Yellow;
      Console.WriteLine("
Foreground color changed = "+Console.ForegroundColor);       Console.CursorSize = 1;       Console.WriteLine("
CursorSize = "+Console.CursorSize);    } }

输出

此示例会产生以下输出 -

更新时间:2019 年 11 月 13 日

161 次浏览

开启你的 职业生涯

完成课程即可获得认证

开始学习
广告
© . All rights reserved.