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?

有帮助吗?

解决方案

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

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top