Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> C#

Cách thay đổi CursorSize của Console trong C#

Để thay đổi kích thước con trỏ của Console trong C#, sử dụng thuộc tính Console.CursorSize.

Ví dụ

using System; 
class Demo { 
    public static void Main (string[] args) { 
        Console.BackgroundColor = ConsoleColor.Blue; 
        Console.WriteLine("Màu nền đã thay đổi = " + Console.BackgroundColor); 
        Console.ForegroundColor = ConsoleColor.Yellow; 
        Console.WriteLine("\nMàu chữ đã thay đổi = " + Console.ForegroundColor); 
        Console.CursorSize = 1; 
        Console.WriteLine("\nCursorSize = " + Console.CursorSize); 
    } 
}

Kết quả

Cách thay đổi CursorSize của Console trong C#