• <legend id='6j0AG'><style id='6j0AG'><dir id='6j0AG'><q id='6j0AG'></q></dir></style></legend>

      <tfoot id='6j0AG'></tfoot>

        • <bdo id='6j0AG'></bdo><ul id='6j0AG'></ul>

        <small id='6j0AG'></small><noframes id='6j0AG'>

        <i id='6j0AG'><tr id='6j0AG'><dt id='6j0AG'><q id='6j0AG'><span id='6j0AG'><b id='6j0AG'><form id='6j0AG'><ins id='6j0AG'></ins><ul id='6j0AG'></ul><sub id='6j0AG'></sub></form><legend id='6j0AG'></legend><bdo id='6j0AG'><pre id='6j0AG'><center id='6j0AG'></center></pre></bdo></b><th id='6j0AG'></th></span></q></dt></tr></i><div id='6j0AG'><tfoot id='6j0AG'></tfoot><dl id='6j0AG'><fieldset id='6j0AG'></fieldset></dl></div>

      1. 如何修改上一行控制台文本?

        时间:2023-08-27
      2. <small id='Q46Md'></small><noframes id='Q46Md'>

          <bdo id='Q46Md'></bdo><ul id='Q46Md'></ul>
            <i id='Q46Md'><tr id='Q46Md'><dt id='Q46Md'><q id='Q46Md'><span id='Q46Md'><b id='Q46Md'><form id='Q46Md'><ins id='Q46Md'></ins><ul id='Q46Md'></ul><sub id='Q46Md'></sub></form><legend id='Q46Md'></legend><bdo id='Q46Md'><pre id='Q46Md'><center id='Q46Md'></center></pre></bdo></b><th id='Q46Md'></th></span></q></dt></tr></i><div id='Q46Md'><tfoot id='Q46Md'></tfoot><dl id='Q46Md'><fieldset id='Q46Md'></fieldset></dl></div>

          • <tfoot id='Q46Md'></tfoot>

                  <tbody id='Q46Md'></tbody>

              • <legend id='Q46Md'><style id='Q46Md'><dir id='Q46Md'><q id='Q46Md'></q></dir></style></legend>

                  本文介绍了如何修改上一行控制台文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我想实现这样的目标:

                  Time consuming operation...OK
                  Another time consuming operation...
                  And another one, but it completed, so...OK
                  

                  我显示了 3 行文本,每行都与一个线程相关,该线程迟早会结束.但如果第二个比第三个晚完成,我会得到这样的结果:

                  I displayed 3 line of text, each one related with a thread which can end sooner or later. But if the second one complete later than the third one, I'll get something like this:

                  Time consuming operation...OK
                  Another time consuming operation...
                  And another one, but it completed, so...OKOK
                  

                  这当然是不可接受的.我知道如何返回当前行,但有没有办法向上?我发誓我在某个地方见过它,虽然它可能是一个 Linux 控制台 :)

                  Which is of course unacceptable. I know how to go back in current line, but is there a way to go UP? I'd swear I've seen it somewhere, though it could be a Linux console :)

                  算了.请参阅远文件管理器!它适用于 Windows 控制台,甚至适用于 PowerShell!如何制作这样的东西?最酷的部分是它在退出后恢复控制台状态.所以也许我应该问 - 如何直接访问控制台缓冲区?我想我需要一些本机代码才能做到这一点,但也许还有另一种方法?我想在每次更新时清除控制台,但这似乎有点矫枉过正.或者也许不是?它会闪烁吗?

                  Forget it. See Far File Manager! It works in Windows console, it works even in PowerShell! How to make something like this? And the coolest part is it restores console state after exiting. So maybe I should ask - how to access console buffer directly? I assume I'll need some native code to do the trick, but maybe there's another way? I thought of clearing console with each update, but this seems like overkill. Or maybe it isn't? Will it blink?

                  推荐答案

                  您可以随意移动光标:Console.SetCursorPosition 或使用 Console.CursorTop.

                  You can move cursor wherever you want: Console.SetCursorPosition or use Console.CursorTop.

                  Console.SetCursorPosition(0, Console.CursorTop -1);
                  Console.WriteLine("Over previous line!!!");
                  

                  这篇关于如何修改上一行控制台文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:.NET 控制台 TextWriter 可以理解 Indent/Unndent/IndentL 下一篇:编写控制台应用程序时,有没有办法创建第二个

                  相关文章

                  最新文章

                  <legend id='h7GNk'><style id='h7GNk'><dir id='h7GNk'><q id='h7GNk'></q></dir></style></legend>
                1. <tfoot id='h7GNk'></tfoot>
                    <bdo id='h7GNk'></bdo><ul id='h7GNk'></ul>

                2. <i id='h7GNk'><tr id='h7GNk'><dt id='h7GNk'><q id='h7GNk'><span id='h7GNk'><b id='h7GNk'><form id='h7GNk'><ins id='h7GNk'></ins><ul id='h7GNk'></ul><sub id='h7GNk'></sub></form><legend id='h7GNk'></legend><bdo id='h7GNk'><pre id='h7GNk'><center id='h7GNk'></center></pre></bdo></b><th id='h7GNk'></th></span></q></dt></tr></i><div id='h7GNk'><tfoot id='h7GNk'></tfoot><dl id='h7GNk'><fieldset id='h7GNk'></fieldset></dl></div>

                  <small id='h7GNk'></small><noframes id='h7GNk'>