如何在 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.