
You want to change the height of your Console window application written in the C# language. This can make certain Console programs much easier to use, particularly if they have a lot of output. We test the Console.WindowHeight property, finding its maximum and minimum values.
Minimum and maximum values for WindowHeight
Maximum height may be different on your system.
Minumum height = 1
Maximum height = 83You can change the height of the Console window simply by assigning an integer to the WindowHeight property. The hard part is knowing what to set the value to. You can find the largest available height by using the LargestWindowHeight property. The minimum height is 1.
This C# program uses the Console.WindowHeight property. It gets the LargestWindowHeight.
Program that tests Console.WindowHeight [C#]
using System;
using System.Threading;
class Program
{
static void Main()
{
for (int i = 1; i <= Console.LargestWindowHeight; i++)
{
Console.Clear();
Console.WriteLine("Height = {0}", i);
Console.WindowHeight = i;
Thread.Sleep(100);
}
}
}
Output
Height = 83
Press any key to continue...Overview. This program will show all the possible console heights possible on your system. On the present system, it goes from the minimum height of 1 to the maximum height of 83 rows. Depending on your screen resolution, you may have a different maximum number of rows.

What are some ideas for finding the best window height? Unfortunately, if you set the WindowHeight to LargestWindowHeight, this will cause the window to go off the screen unless it is at the very top. Therefore, it might be better to use a size that is a few rows smaller than LargestWindowHeight. Try subtracting 20 rows from LargetWindowHeight.
Though Console programs are not examples of the most sophisticated user interface design, they can be made more usable. One way you can do this is by adjusting the height of the window to make more text readable, as with the Console.WindowHeight and Console.LargestWindowHeight properties.
Console Programs