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