如何在C#中更改Windows控制台应用程序中的背景颜色

时间:2018-04-14 20:49:08

标签: c# colors visual-studio-2017

在Visual Studio 2017中,代码为:

Console.BackgoundColor = Console.Color.Blue;

不适用于Visual Studio

有谁知道我能做什么

我正在尝试将背景更改为绿色并再次返回

2 个答案:

答案 0 :(得分:0)

您需要在设置颜色enter image description here

后清除控制台
Console.Clear();

答案 1 :(得分:0)

使用ConsoleColor

 File "/data/user/0/ru.iiec.pydroid2/files/arm-linux-androideabi/lib/python2.7/site-packages/kivy/lang/builder.py", line 831, in _build_canvas
     '{}: {}'.format(e.__class__.__name__, e), cause=tb)
 kivy.lang.builder.BuilderException: Parser: File "<inline>", line 9:
 ...
       7:    canvas.before:
       8:        Color:
 >>    9:            rgba: yardim.my_colors
      10:        Rectangle:
      11:            pos: self.pos
 ...
 TypeError: 'NoneType' object is not iterable
   File "/data/user/0/ru.iiec.pydroid2/files/arm-linux-androideabi/lib/python2.7/site-packages/kivy/lang/builder.py", line 826, in _build_canvas
     setattr(instr, key, value)
   File "kivy/graphics/context_instructions.pyx", line 262, in kivy.graphics.context_instructions.Color.rgba.__set__ (kivy/graphics/context_instructions.c:6428)