簡體   English   中英

新手,在Visual Studio中更改前景色

[英]newbie, changing foreground color in visual studio

我一直在做本教程之一,並且弄亂了控制台應用程序的前景色。 這就是原始代碼的外觀,但是我四處游盪並退出到一半,在C#和Python項目上都不是深洋紅色,真的很難看==(((

  // Preserve current console text color; ConsoleColor oldColor = Console.ForegroundColor; // Change console text color Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine("Test Color"); // Cleaning up Console.ForegroundColor = oldColor; 

我試圖用它來更改它,但是似乎要做的是更改控制台顏色,當我在Python項目中進行調試時,但是與此同時,當我在Python中執行同一項目的No Debag時,它仍然可以將其恢復。

Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine(“測試顏色”);

我試過做它的各種命令,並通過創建新項目來檢查它,但沒有幫助=(

我在這里不是很了解,但是如果您需要品紅色,就不能更改:

Console.ForegroundColor = ConsoleColor.Gray;
        Console.WriteLine("Test Color")

Console.ForegroundColor = ConsoleColor.Magenta;
        Console.WriteLine("Test Color")

如果您要洋紅色。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM