在命令窗口中重写字符
我想在 C# 控制台应用程序中输出一些字符,然后重写它们,从而更改命令窗口中已占用位置的字符。例如,我可以以 10%、20%、30% 的百分比显示进度(但在同一个地方)。我怎样才能做到这一点?
I want to output some characters in C# console application and then rewrite them, thus changing characters in position already occupied in command window. So for for example I could show progress in percentages 10%, 20%, 30% (but in the same place). How can I do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看看编写字符串在 C# 2.0 中使用 Console.Write 在同一位置
Have a look at Writing string at the same position using Console.Write in C# 2.0
如果打印'\r'字符,光标将返回到当前行,例如
If you print a '\r' character, the cursor will return back to the current line, e.g.