Blink text in C#

前端 未结 7 1261
隐瞒了意图╮
隐瞒了意图╮ 2021-01-14 03:17

How do i blink the text in console using C#?

7条回答
  •  一向
    一向 (楼主)
    2021-01-14 03:34


    Why not use backspace and rewrite the text on the same screen line?

    string blink = "Password Please!"
    
    while (!System.Console.KeyAvailable)
       {
          Console.Write(blink);
          Thread.Sleep(650);
    
          for (int j = 1; j <= blink.Length + 2; j++)
              {
                 Console.Write("\b"+(char)32+"\b");
                 if (j == blink.Length + 2) Thread.Sleep(650);
              }
       }
    

提交回复
热议问题