如何在控制台应用程序 C# 中设置用户无法更改的最小控制台大小?预先感谢您的回答;)
最佳答案
控制台没有任何调整大小事件。但作为解决方法,您可以尝试(不推荐!):
public static void Main(string[] args)
{
const int MinHeight = 10;
const int MinWidth = 10;
Task.Factory.StartNew(() =>
{
while (true)
{
if (Console.WindowHeight > MinHeight || Console.WindowWidth > MinWidth)
{
Console.SetWindowSize(MinWidth, MinHeight);
}
}
});
// Do some work here
Console.ReadKey();
}
关于c# - 如何设置最小控制台大小 C#?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49130432/