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

Thuộc tính Console.WindowLeft trong C#

Console.WindowLeft lấy hoặc thiết lập vị trí trái của cửa sổ console tương đối với screen buffer.

Ví dụ minh họa

using System;

class Demo
{
    static void Main()
    {
        int left = Console.WindowLeft;
        Console.WriteLine("Vị trí trái cửa sổ Console = " + left);
    }
}

Kết quả đầu ra

Vị trí trái cửa sổ Console = 0

Lưu ý: Giá trị 0 do môi trường chạy. Trên Windows console thực, thường là 0. Có thể âm nếu cửa sổ tràn ra ngoài buffer.

Bộ 4 thuộc tính vị trí/kích thước cửa sổ: WindowLeft, WindowTop, WindowWidth, WindowHeight.