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

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

Để thay đổi chiều rộng bộ đệm của Console, sử dụng thuộc tính Console.BufferWidth.

Ví dụ

using System; 
class Demo { 
    public static void Main (string[] args){ 
        Console.BufferHeight = 200; 
        Console.WriteLine("Chiều cao bộ đệm = " + Console.BufferHeight); 
        Console.BufferHeight = 250; 
        Console.WriteLine("Chiều rộng bộ đệm = " + Console.BufferWidth); 
    } 
}

Kết quả

Chiều cao bộ đệm = 200 
Chiều rộng bộ đệm = 200