Console.BufferHeight Свойство
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Возвращает или задает высоту буферной области.
public:
static property int BufferHeight { int get(); void set(int value); };
public static int BufferHeight { [System.Runtime.Versioning.UnsupportedOSPlatform("android")] [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] [System.Runtime.Versioning.UnsupportedOSPlatform("ios")] [System.Runtime.Versioning.UnsupportedOSPlatform("tvos")] get; [System.Runtime.Versioning.SupportedOSPlatform("windows")] set; }
public static int BufferHeight { [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] get; [System.Runtime.Versioning.SupportedOSPlatform("windows")] set; }
public static int BufferHeight { get; set; }
[<get: System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
[<get: System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
[<get: System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<get: System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
[<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")>]
static member BufferHeight : int with get, set
static member BufferHeight : int with get, set
Public Shared Property BufferHeight As Integer
Значение свойства
Текущая высота в строках буферной области.
- Атрибуты
Исключения
Значение операции набора меньше или равно нулю.
–или–
Значение в операции набора больше или равно Int16.MaxValue.
–или–
Значение в операции набора меньше WindowTop + WindowHeight.
У пользователя нет разрешения на выполнение этого действия.
Произошла ошибка ввода-вывода.
Операция набора вызывается в операционной системе, отличной от Windows.
Примеры
В этом примере показаны BufferHeight свойства и BufferWidth свойства. В примере отчеты о измерениях окна операционной системы, заданного для буфера размером в 300 строк и 85 столбцов.
// 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.
'
Комментарии
Это свойство определяет количество строк (или строк), хранящихся в буфере, доступ к которому осуществляется в окне режима консоли. Напротив, WindowHeight свойство определяет количество строк, которые фактически отображаются в окне консоли в любое время. Если количество строк, фактически записанных в буфер, превышает количество строк, определенных WindowHeight свойством, окно можно прокручивать по вертикали, чтобы оно отображалось непрерывное число строк, равных WindowHeight свойству, и находится в любом месте буфера.
Если операция набора уменьшает значение BufferHeight свойства, удаляются верхние строки. Например, если число строк уменьшается с 300 до 250, строки от 0 до 49 удаляются, а существующие строки 50–299 становятся строками 0 до 249.