TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

<< Back to C-SHARP

C# Console.WindowHeight

Use the Console.WindowHeight property and get the LargestWindowHeight.
Console.WindowHeight changes the height of Console windows. This can make certain Console programs much easier to use, particularly if they have a lot of output. We test the Console.WindowHeight property.ConsoleProperty
Minimum and maximum values for WindowHeight Minimum height = 1 Maximum height = 83
Example. You can change the height of the Console window by assigning to the WindowHeight property. The hard part is choosing a value. You can find the largest available height with the LargestWindowHeight property. The minimum height is 1.

Info: On the present system, it goes from the minimum height of 1 to the maximum height of 83 rows.

And: Depending on your screen resolution, you may have a different maximum number of rows.

C# program that tests Console.WindowHeight 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...
Discussion. 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 from it.

Summary. Console programs 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.
© TheDeveloperBlog.com
The Dev Codes

Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf