Console.BufferHeight Vlastnost
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Získá nebo nastaví výšku oblasti vyrovnávací paměti.
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
Hodnota vlastnosti
Aktuální výška oblasti vyrovnávací paměti v řádcích.
- Atributy
Výjimky
Hodnota v operaci sady je menší nebo rovna nule.
nebo
Hodnota v operaci sady je větší nebo rovna Int16.MaxValue.
nebo
Hodnota v operaci sady je menší než WindowTop + WindowHeight.
Uživatel nemá oprávnění k provedení této akce.
Došlo k vstupně-výstupní chybě.
Operace set je vyvolána v jiném operačním systému než Windows.
Příklady
Tento příklad ukazuje vlastnosti BufferHeight a BufferWidth vlastnosti. Příklad hlásí rozměry okna operačního systému nastavené na velikost vyrovnávací paměti 300 řádků a 85 sloupců.
// 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.
'
Poznámky
Tato vlastnost definuje počet řádků (nebo řádků) uložených ve vyrovnávací paměti, ke které přistupuje okno režimu konzoly. Naproti tomu WindowHeight vlastnost definuje počet řádků, které jsou skutečně zobrazeny v okně konzoly v každém konkrétním okamžiku. Pokud počet řádků skutečně zapisovaných do vyrovnávací paměti překračuje počet řádků definovaných WindowHeight vlastností, lze okno posunout svisle, aby se zobrazil souvislý počet řádků, které se rovnají WindowHeight vlastnosti a jsou umístěny kdekoli ve vyrovnávací paměti.
Pokud operace sady zmenší hodnotu BufferHeight vlastnosti, odeberou se horní řádky. Pokud je například počet řádků snížen z 300 na 250, řádky 0 až 49 se odeberou a stávající řádky 50 až 299 se stanou řádky 0 až 249.