Condividi tramite


Console.BufferHeight Proprietà

Definizione

Ottiene o imposta l'altezza dell'area del 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

Valore della proprietà

Altezza corrente, in righe, dell'area del buffer.

Attributi

Eccezioni

Il valore in un'operazione set è minore o uguale a zero.

oppure

Il valore in un'operazione set è maggiore o uguale a Int16.MaxValue.

oppure

Il valore di un'operazione set è minore di WindowTop + WindowHeight.

L'utente non dispone dell'autorizzazione per l'esecuzione di questa azione.

Si è verificato un errore di I/O.

L'operazione set viene richiamata in un sistema operativo diverso da Windows.

Esempio

In questo esempio vengono illustrate le BufferHeight proprietà e BufferWidth . Nell'esempio vengono riportate le dimensioni di una finestra del sistema operativo impostata su una dimensione del buffer di 300 righe e 85 colonne.

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

Commenti

Questa proprietà definisce il numero di righe (o righe) archiviate nel buffer a cui si accede da una finestra della modalità console. Al contrario, la WindowHeight proprietà definisce il numero di righe effettivamente visualizzate nella finestra della console in un determinato momento. Se il numero di righe effettivamente scritte nel buffer supera il numero di righe definite dalla WindowHeight proprietà , è possibile scorrere verticalmente la finestra in modo che visualizzi un numero contiguo di righe uguali alla WindowHeight proprietà e che si trovi in un punto qualsiasi del buffer.

Se un'operazione set riduce il valore della BufferHeight proprietà, le righe superiori vengono rimosse. Ad esempio, se il numero di righe viene ridotto da 300 a 250, le righe da 0 a 49 vengono rimosse e le righe esistenti da 50 a 299 diventano righe da 0 a 249.

Si applica a