在C#2.0中使用Console.Write同一位置写入字符串 [英] Writing string at the same position using Console.Write in C# 2.0

查看:405
本文介绍了在C#2.0中使用Console.Write同一位置写入字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个控制台应用程序项目在C#2.0中需要写一些东西到屏幕while循环。我不想在屏幕上滚动,因为使用Console.Write或Console.Writeline方法将继续incremently显示在控制台屏幕上的文字,并因此开始滚动。

I have a console application project in C# 2.0 that needs to write something to the screen in a while loop. I do not want the screen to scroll because using Console.Write or Console.Writeline method will keep displaying text on console screen incremently and thus it starts scrolling.

我想有写在同一位置的字符串。我怎样才能做到这一点?

I want to have the string written at the same position. How can i do this?

感谢

推荐答案

使用<一个href="http://msdn.microsoft.com/en-us/library/system.console.setcursorposition.aspx">Console.SetCursorPosition设置位置。如果您需要首先确定它,使用 Console.CursorLeft 和<一HREF =htt​​p://msdn.microsoft.com/en-us/library/system.console.cursortop.aspx> Console.CursorTop 属性。

Use Console.SetCursorPosition to set the position. If you need to determine it first, use the Console.CursorLeft and Console.CursorTop properties.

这篇关于在C#2.0中使用Console.Write同一位置写入字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆