Để thay đổi CursorTop của Console trong C #, hãy sử dụng thuộc tính Console.CursorTop
Ví dụ
Bây giờ chúng ta hãy xem một ví dụ -
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.CursorTop = 20;
Console.WriteLine("\nCursorTop = "+Console.CursorTop);
}
} Đầu ra
Điều này sẽ tạo ra kết quả sau -