Partilhar via


Console.BufferHeight Propriedade

Definição

Obtém ou define a altura da área de buffer.

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 da propriedade

A altura atual, em linhas, da área de buffer.

Atributos

Exceções

O valor em uma operação de conjunto é menor ou igual a zero.

- ou -

O valor em uma operação de conjunto é maior ou igual a Int16.MaxValue.

- ou -

O valor em uma operação de conjunto é menor que WindowTop + WindowHeight.

O usuário não tem permissão para executar esta ação.

Ocorreu um erro de E/S.

A operação definida é invocada em um sistema operacional diferente do Windows.

Exemplos

Este exemplo demonstra as propriedades e BufferWidth as BufferHeight propriedades. O exemplo relata as dimensões de uma janela do sistema operacional definida como um tamanho de 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.
'

Comentários

Essa propriedade define o número de linhas (ou linhas) armazenadas no buffer que é acessado por uma janela de modo de console. Por outro lado, a WindowHeight propriedade define o número de linhas que são exibidas na janela do console a qualquer momento específico. Se o número de linhas realmente gravadas no buffer exceder o número de linhas definidas pela WindowHeight propriedade, a janela poderá ser rolada verticalmente para exibir um número contíguo de linhas que são iguais à WindowHeight propriedade e estão localizadas em qualquer lugar no buffer.

Se uma operação de conjunto diminuir o valor da BufferHeight propriedade, as linhas superiores serão removidas. Por exemplo, se o número de linhas for reduzido de 300 para 250, as linhas 0 a 49 serão removidas e as linhas existentes de 50 a 299 se tornarão linhas 0 a 249.

Aplica-se a