I am trying to set the size of the Console Window in a c# console application. I get an ArgumentOutOfRangeException
with this message:
The value must be less than the console's current maximum window size of 41 in that dimension. Note that this value depends on screen resolution and the console font.
I am using this to set it:
Console.WindowHeight = 480;
How do you set the Console window's size properly?
Console height is specified in rows (lines), not pixels.
http://msdn.microsoft.com/en-us/library/system.console.windowheight.aspx
From MSDN of
Console.WindowHeight
property: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
andConsole.LargestWindowHeight
properties.you can set a windowHeight less than 62, if u try exceed this value error throw the system.
The above information catch Console[from metadata].