Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> C#

วิธีเปลี่ยนสีพื้นหลังข้อความใน C# Console


หากต้องการเปลี่ยนสีพื้นหลังของข้อความในคอนโซล ให้ใช้คุณสมบัติ Console.BackgroundColor ใน C#

ตัวอย่าง

using System; 
class Demo { 
    public static void Main (string[] args) { 
        Console.BackgroundColor = ConsoleColor.Blue; 
        Console.WriteLine("Background color changed = " + Console.BackgroundColor); 
    } 
}

ผลลัพธ์

วิธีเปลี่ยนสีพื้นหลังข้อความใน C# Console