Domanda

I would like to write a .NET Console Application that shows certain values and statistics.

For this I need the Console to not scroll and write to certain places on the console window.

I have seen this behaviour in other applications as well (e.g. unix top/htop) and was wondering if there is a libary for .NET to do this?

È stato utile?

Soluzione

You can use the Console.SetCursorPosition method to position the cursor over existing text so you overwrite it instead of "appending" to the end.

Altri suggerimenti

You might look at the answers to this question for possibilities.

The built-in Console class also has CursorLeft, CursorTop, WindowWidth, and WindowHeight properties that you can use to figure out the size of the console window, and SetCursorPosition to position the cursor prior to writing. The documentation for the Console Class might give you a hint for any other functionality you need.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top