Changing Console Window's size throws ArgumentOutOfRangeException

前端 未结 4 1090
有刺的猬
有刺的猬 2021-01-07 19:39

I am trying to set the size of the Console Window in a c# console application. I get an ArgumentOutOfRangeException with this message:

Th

4条回答
  •  盖世英雄少女心
    2021-01-07 20:15

    From MSDN of Console.WindowHeight property:

    The height of the console window measured in rows.

    As you can see, these are not pixels. Just remember, these values can change depending on your screen resolution and the console font. You can find maximum height and width values with Console.LargestWindowWidth and Console.LargestWindowHeight properties.

    Console.WriteLine(Console.LargestWindowHeight);
    Console.WriteLine(Console.LargestWindowWidth);
    

提交回复
热议问题