如何在C#中更改控制台的WindowHeight?
使用Console.WindowHeight属性更改控制台的WindowHeight。
示例
现在让我们看一个例子-
using System;using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Demo {
public static void Main (string[] args) {
Console.InputEncoding = Encoding.ASCII;
Console.WriteLine("Input Encoding Scheme = "+Console.InputEncoding);
Console.OutputEncoding = Encoding.ASCII;
Console.WriteLine("Output Encoding Scheme = "+Console.OutputEncoding);
Console.CursorVisible = false;
Console.Write("\nCursor is Visible? "+ Console.CursorVisible);
Console.WindowHeight = 30;
Console.Write("WindowHeight = "+Console.WindowHeight);
}
}
输出结果
这将产生以下输出-
Input Encoding Scheme = System.Text.ASCIIEncodingOutput Encoding Scheme = System.Text.ASCIIEncoding
Cursor is Visible? False
WindowHeight = 30
以上是 如何在C#中更改控制台的WindowHeight? 的全部内容, 来源链接: utcz.com/z/334916.html