C#Console.WindowWidth属性
WindowWidth属性获取或设置控制台窗口的宽度。
声明一个变量。
int width;
现在,获取当前窗口的宽度。
width = Console.WindowWidth;
以下是完整的示例。
示例
using System;
using System.Numerics;
using System.Globalization;
class Demo {
static void Main() {
int width;
int height;
width = Console.WindowWidth;
height = Console.WindowHeight;
Console.WriteLine("Current window width = "+width);
Console.WriteLine("Current window height = "+height);
}
}输出结果
Current window width = 0 Current window height = 0