Console.BufferHeight Properti

Definisi

Mendapatkan atau mengatur tinggi area buffer.

public:
 static property int BufferHeight { int get(); void set(int value); };
public static int BufferHeight { [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] get; [System.Runtime.Versioning.SupportedOSPlatform("windows")] set; }
public static int BufferHeight { [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] [System.Runtime.Versioning.UnsupportedOSPlatform("android")] [System.Runtime.Versioning.UnsupportedOSPlatform("ios")] [System.Runtime.Versioning.UnsupportedOSPlatform("tvos")] get; [System.Runtime.Versioning.SupportedOSPlatform("windows")] set; }
public static int BufferHeight { get; set; }
[<get: System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
[<set: System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member BufferHeight : int with get, set
[<get: System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
[<set: System.Runtime.Versioning.SupportedOSPlatform("windows")>]
[<get: System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
[<get: System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<get: System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member BufferHeight : int with get, set
static member BufferHeight : int with get, set
Public Shared Property BufferHeight As Integer

Nilai Properti

Tinggi saat ini, dalam baris, dari area buffer.

Atribut

Pengecualian

Nilai dalam operasi yang ditetapkan kurang dari atau sama dengan nol.

-atau-

Nilai dalam operasi yang ditetapkan lebih besar dari atau sama dengan Int16.MaxValue.

-atau-

Nilai dalam operasi yang ditetapkan kurang dari WindowTop + WindowHeight.

Pengguna tidak memiliki izin untuk melakukan tindakan ini.

Terjadi kesalahan I/O.

Operasi yang ditetapkan dipanggil pada sistem operasi selain Windows.

Contoh

Contoh ini menunjukkan BufferHeight properti dan BufferWidth . Contoh melaporkan dimensi jendela sistem operasi yang diatur ke ukuran buffer 300 baris dan 85 kolom.

// This example demonstrates the Console.BufferHeight and 
//                               Console.BufferWidth properties.
using namespace System;
int main()
{
   Console::WriteLine( "The current buffer height is {0} rows.", Console::BufferHeight );
   Console::WriteLine( "The current buffer width is {0} columns.", Console::BufferWidth );
}

/*
This example produces the following results:

The current buffer height is 300 rows.
The current buffer width is 85 columns.
*/
// This example demonstrates the Console.BufferHeight and
//                               Console.BufferWidth properties.
using System;

class Sample
{
    public static void Main()
    {
    Console.WriteLine("The current buffer height is {0} rows.",
                      Console.BufferHeight);
    Console.WriteLine("The current buffer width is {0} columns.",
                      Console.BufferWidth);
    }
}
/*
This example produces the following results:

The current buffer height is 300 rows.
The current buffer width is 85 columns.
*/
// This example demonstrates the Console.BufferHeight and
//                               Console.BufferWidth properties.
open System

printfn $"The current buffer height is {Console.BufferHeight} rows."
printfn $"The current buffer width is {Console.BufferWidth} columns."

// This example produces the following results:
//
// The current buffer height is 300 rows.
// The current buffer width is 85 columns.
' This example demonstrates the Console.BufferHeight and 
'                               Console.BufferWidth properties.
Class Sample
   Public Shared Sub Main()
      Console.WriteLine("The current buffer height is {0} rows.", _
                        Console.BufferHeight)
      Console.WriteLine("The current buffer width is {0} columns.", _
                        Console.BufferWidth)
   End Sub
End Class
'
'This example produces the following results:
'
'The current buffer height is 300 rows.
'The current buffer width is 85 columns.
'

Keterangan

Properti ini menentukan jumlah baris (atau baris) yang disimpan dalam buffer yang diakses oleh jendela mode konsol. Sebaliknya, WindowHeight properti menentukan jumlah baris yang benar-benar ditampilkan di jendela konsol pada waktu tertentu. Jika jumlah baris yang benar-benar ditulis ke buffer melebihi jumlah baris yang ditentukan oleh WindowHeight properti , jendela dapat digulir secara vertikal sehingga menampilkan jumlah baris yang berdekatan yang sama dengan WindowHeight properti dan terletak di mana saja di buffer.

Jika operasi set mengurangi nilai BufferHeight properti, baris paling atas akan dihapus. Misalnya, jika jumlah garis dikurangi dari 300 menjadi 250, baris 0 hingga 49 dihapus, dan baris yang ada 50 hingga 299 menjadi garis 0 hingga 249.

Berlaku untuk