开发者

Is there a fancier Console library for C#? [closed]

开发者 https://www.devze.com 2023-03-01 14:46 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. 开发者_JS百科

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 8 years ago.

Improve this question

Is there any library for .NET which can:

  • output characters/words in color
  • draw stuff in console like progress bars (similar to wget)
  • other funny beautiful things i might consider using in my glamor console app


Yes; the Console class can do all of that.

  • Set Console.ForegroundColor
  • Print Unicode Box Drawing Characters and set CursorLeft and CursorTop
  • Such as?


ConsoleEx

The ConsoleEx library, written a long time ago by Microsoftie, Tim Sneath, can do some advanced coloring and writing to positions. It's generally a lot better than the Console, even the .NET 4.0 Console (as far as I can tell).

And it's on NuGet!


I have had a bit of success with a progress indicator. This block is called from an event and may be called from multiple threads. it displays 1% and increments as appropriate on one line.

private object thislock = new Object();
void UpdateProgress(DownloadProgressChangedEventArgs e)
{
    lock (thislock)
    {
        for (int i = 0; i < 50; i++)
        {
            Console.Write("\b");
        }
        Console.Write(e.ProgressPercentage.ToString() + "%");
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消