Console.BufferHeight Tulajdonság

Definíció

Lekéri vagy beállítja a pufferterület magasságát.

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

Tulajdonság értéke

A pufferterület aktuális magassága sorokban.

Attribútumok

Kivételek

A halmazművelet értéke kisebb vagy egyenlő nullánál.

-vagy-

A halmazművelet értéke nagyobb vagy egyenlő az Int16.MaxValue értéknél.

-vagy-

A megadott művelet értéke kisebb, mint WindowTop + WindowHeight.

A felhasználónak nincs engedélye a művelet végrehajtására.

I/O-hiba történt.

A beállított műveletet a rendszer nem Windows operációs rendszeren hívja meg.

Példák

Ez a példa a tulajdonságokat és BufferHeight a BufferWidth tulajdonságokat mutatja be. A példa egy 300 sorból és 85 oszlopból álló pufferméretre beállított operációsrendszer-ablak méreteit jelenti.

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

Megjegyzések

Ez a tulajdonság határozza meg a konzol módú ablak által elért pufferben tárolt sorok (vagy sorok) számát. Ezzel szemben a WindowHeight tulajdonság határozza meg, hogy hány sor jelenjen meg ténylegesen a konzolablakban egy adott időpontban. Ha a pufferbe ténylegesen írt sorok száma meghaladja a tulajdonság által WindowHeight definiált sorok számát, az ablak függőlegesen görgethető, hogy a tulajdonságnak egybefüggő számú sort jelenítsen meg, amelyek megegyeznek a WindowHeight tulajdonságmal, és a pufferben bárhol találhatók.

Ha egy halmazművelet csökkenti a BufferHeight tulajdonság értékét, a rendszer eltávolítja a legfelső sorokat. Ha például a vonalak száma 300-ról 250-re csökken, a 0–49., a meglévő 50–299. vonalak pedig 0–249.

A következőre érvényes: