หากต้องการเปลี่ยนสีพื้นหลังของข้อความใน Console ให้ใช้ Console.BackgroundColorProperty ใน C#
ตัวอย่าง
เรามาดูตัวอย่างกัน −
using System;
class Demo {
public static void Main (string[] args) {
Console.BackgroundColor = ConsoleColor.Blue;
Console.WriteLine("Background color changed = "+Console.BackgroundColor);
}
} ผลลัพธ์
สิ่งนี้จะสร้างผลลัพธ์ต่อไปนี้ -
