如何防止控制台颜色搞乱 [英] How to prevent console colors messing up
问题描述
我看到Console的另一个问题令人沮丧。
I'm seeing another problem with Console that's frustrating.
如果我写了一些文字然后改回颜色然后写下10个空格然后改回背面颜色,它看起来像我期望的那样,在黑色窗口上写下白色文字,后面有一行10个空格。
If I write some text then change back color then write say 10 spaces then change the back color back, it looks as I'd expect, say white text on black window with a row of 10 white spaces after it.
但是一旦我调整控制台窗口的大小,就会用白色写的空格一切似乎都消失了,不再有任何白色空间的痕迹了!
But as soon as I resize the console window the spaces that were written in white all seem to vanish and there's no longer any trace of the block of white spaces!
这就是这样吗?
(如果我使用空格以外的字符我不会遇到这个问题。)
(If I use chars other than space I dont get this issue).
推荐答案
< p style ="margin:0px 0px 10.66px"> 也许不要改变颜色;画另一个角色:
Console.WriteLine( new
string ( '\ u2588' ,
10));
Console.WriteLine( new string ('\u2588', 10) );
这篇关于如何防止控制台颜色搞乱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!