獲取 C# 中控制檯的最大視窗高度和寬度


要獲取控制檯的最大視窗高度,程式碼如下 −

示例

 現場演示

using System;
public class Demo{
   public static void Main(string[] args){
      Console.WriteLine("Largest Window Height of the Console = "+Console.LargestWindowHeight);
   }
}

輸出

這將產生以下輸出 −

Largest Window Height of the Console = 58

示例

要獲取控制檯的最大視窗寬度,程式碼如下 −

 現場演示

using System;
public class Demo{
   public static void Main(string[] args){
      Console.WriteLine("Largest Window Width of the Console = "+Console.LargestWindowWidth);
   }
}

輸出

這將產生以下輸出 −

Largest Window Width of the Console = 190

更新於:11-12-2019

193 瀏覽量

開啟您的 職業生涯

完成課程,獲得認證。

開始吧
廣告