class Test
{
static void Main()
{
Console.Write("abcd\b");
Console.WriteLine(); //@1 Console.WriteLine("abcd\b"); //@2 Console.Write("abcd\b\n"); //@3
Console.Write("abcd\b"); //@4 }\b 退格 正常情况下应该回退一个位 如 @4但@1 @2 @3 处 其实这三处一个意思 /b不再起作用程序输出:
abcd
abcd
abcd
abc如何解呢?????
{
static void Main()
{
Console.Write("abcd\b");
Console.WriteLine(); //@1 Console.WriteLine("abcd\b"); //@2 Console.Write("abcd\b\n"); //@3
Console.Write("abcd\b"); //@4 }\b 退格 正常情况下应该回退一个位 如 @4但@1 @2 @3 处 其实这三处一个意思 /b不再起作用程序输出:
abcd
abcd
abcd
abc如何解呢?????
解决方案 »
- xpf.grid GridContriol多行选后如何去选中行的数据。
- Excel导出后找不到导出文件,请大家指教
- ShockwaveFlash 播放flash时背景透明疑难
- 请教高手该接口该如何实现
- 如何在弹出窗口中向原窗口传值(ASP.NET,C#)?
- 请问可以让windows服务定时执行项目的中的一个或多个form吗?
- 高手帮个忙啊,VS2005环境下使label标签的文字自动换行啊?
- 导出word文档
- 关于XmlTextReader的问题,WhitespaceHandling的命名空间需要什么?
- 用 c# 编写的英文版的软件运行在英文平台上,想让此软件能够处理汉字,该怎么做?
- 我想不明白
- showModalDialog后在C#中怎么关闭
{
static void Main()
{
Console.Write("abcd\b123");
Console.WriteLine(); //@1 Console.WriteLine("abcd\b123"); //@2 Console.Write("abcd\b123\n"); //@3
Console.Write("abcd\b123"); //@4 }
你这样 实验下看123 跟 abcd 是不是在一行且有距离
Console.Write("\b\b");
Console.CursorLeft -= 2;而回车,则是把光标移动到下一行,同时移动到行首(*有些旧的打字机需要另一个命令\r,才能移动到行首)。
它同样也没有负责擦除。因此,Console.Write("abcd\b\n")就相当于输出abcd,光标左移一格,光标另起一行,所以看到的输出还是abcd
而Console.Write("abcd\bX")由于X输出到d所在的缓冲区,并覆盖掉d,我们将看到abcX的输出。下面例子演示了改变光标位置,还算有趣:using System;
class Program
{
static void Main()
{
System.Threading.ThreadPool.QueueUserWorkItem(delegate
{
string text = "The quick brown fox jumps over the lazy dog";
while (true)
{
Console.ForegroundColor = ConsoleColor.White;
Console.Write(System.Environment.NewLine + text);
Console.ForegroundColor = ConsoleColor.DarkYellow;
for (int i = text.Length - 1; i >= 0; i--)
{
Console.CursorLeft = i;
Console.Write(text[i]);
System.Threading.Thread.Sleep(100);
}
}
});
Console.Read();
}
}
你在后面再加句console.readline();
结果是
abcd
abcd
abcd
abcd
是光标退格,不是删除字符
前辈你说的我懂 我是想知道这个输出 abc 怎么解 并没有字符覆盖d呀
前辈 你说的我懂 我是想知道 这个输出 abc 怎么解 并没有字符覆盖d呀