Console.BufferHeight Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Obtém ou define a altura da área de tampão.
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
Valor de Propriedade
A altura atual, em filas, da área tampão.
- Atributos
Exceções
O valor numa operação de conjunto é menor ou igual a zero.
-ou-
O valor numa operação de conjunto é maior ou igual a Int16.MaxValue.
-ou-
O valor numa operação de conjunto é menor que WindowTop + WindowHeight.
O usuário não tem permissão para executar essa ação.
Ocorreu um erro de I/O.
A operação de set é invocada num sistema operativo diferente do Windows.
Exemplos
Este exemplo demonstra as BufferHeight propriedades e BufferWidth . O exemplo reporta as dimensões de uma janela do sistema operativo definida para um buffer de 300 linhas e 85 colunas.
// 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.
'
Observações
Esta propriedade define o número de linhas (ou linhas) armazenadas no buffer acedido por uma janela de modo consola. Em contraste, a WindowHeight propriedade define o número de linhas que são realmente exibidas na janela da consola em determinado momento. Se o número de linhas efetivamente escritas no buffer exceder o número de linhas definidas pela WindowHeight propriedade, a janela pode ser deslocada verticalmente para mostrar um número contíguo de linhas igual à WindowHeight propriedade e localizadas em qualquer lugar do buffer.
Se uma operação de conjunto diminuir o valor da BufferHeight propriedade, as linhas superiores são removidas. Por exemplo, se o número de linhas for reduzido de 300 para 250, as linhas 0 a 49 são removidas, e as linhas existentes de 50 a 299 tornam-se linhas 0 a 249.