Console.BufferHeight Właściwość

Definicja

Pobiera lub ustawia wysokość obszaru buforu.

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

Wartość właściwości

Bieżąca wysokość w wierszach obszaru buforu.

Atrybuty

Wyjątki

Wartość operacji zestawu jest mniejsza niż lub równa zero.

-lub-

Wartość operacji zestawu jest większa lub równa int16.MaxValue.

-lub-

Wartość operacji zestawu jest mniejsza niż WindowTop + WindowHeight.

Użytkownik nie ma uprawnienia do wykonania tej czynności.

Wystąpił błąd we/wy.

Operacja set jest wywoływana w systemie operacyjnym innym niż Windows.

Przykłady

W tym przykładzie przedstawiono BufferHeight właściwości i BufferWidth . W przykładzie przedstawiono wymiary okna systemu operacyjnego ustawionego na rozmiar buforu 300 wierszy i 85 kolumn.

// 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.
'

Uwagi

Ta właściwość definiuje liczbę wierszy (lub wierszy) przechowywanych w buforze dostępnym przez okno trybu konsoli. WindowHeight Natomiast właściwość definiuje liczbę wierszy, które są rzeczywiście wyświetlane w oknie konsoli w dowolnym momencie. Jeśli liczba wierszy zapisanych w buforze przekracza liczbę wierszy zdefiniowanych przez WindowHeight właściwość, okno można przewijać w pionie, aby wyświetlać ciągłą liczbę wierszy, które są równe WindowHeight właściwości i znajdują się w dowolnym miejscu w buforze.

Jeśli operacja ustawiania zmniejsza wartość BufferHeight właściwości, zostaną usunięte najbardziej górne wiersze. Jeśli na przykład liczba wierszy zostanie zmniejszona z 300 do 250, linie od 0 do 49 zostaną usunięte, a istniejące linie od 50 do 299 staną się liniami od 0 do 249.

Dotyczy