Console.BufferWidth Vlastnost

Definice

Získá nebo nastaví šířku oblasti vyrovnávací paměti.

public:
 static property int BufferWidth { int get(); void set(int value); };
public static int BufferWidth { [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] get; [System.Runtime.Versioning.SupportedOSPlatform("windows")] set; }
public static int BufferWidth { [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] [System.Runtime.Versioning.UnsupportedOSPlatform("android")] [System.Runtime.Versioning.UnsupportedOSPlatform("ios")] [System.Runtime.Versioning.UnsupportedOSPlatform("tvos")] get; [System.Runtime.Versioning.SupportedOSPlatform("windows")] set; }
public static int BufferWidth { get; set; }
[<get: System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
[<set: System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member BufferWidth : int with get, set
[<get: System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
[<set: System.Runtime.Versioning.SupportedOSPlatform("windows")>]
[<get: System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
[<get: System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<get: System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member BufferWidth : int with get, set
static member BufferWidth : int with get, set
Public Shared Property BufferWidth As Integer

Hodnota vlastnosti

Aktuální šířka oblasti vyrovnávací paměti ve sloupcích.

Atributy

Výjimky

Hodnota v operaci set je menší než nebo rovna nule.

-nebo-

Hodnota v operaci set je větší než nebo rovna Hodnotě Int16.MaxValue.

-nebo-

Hodnota v operaci set je menší než WindowLeft + WindowWidth.

Uživatel nemá oprávnění k provedení této akce.

Došlo k vstupně-výstupní chybě.

Operace nastavení je vyvolána v jiném operačním systému než Windows.

Příklady

Tento příklad ukazuje BufferHeight vlastnosti a BufferWidth . 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 namespace System;
int 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.
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

Pokud operace nastavení sníží hodnotu BufferWidth vlastnosti, odeberou se sloupce nejvíce vpravo. Pokud se například sníží počet sloupců z 80 na 60, odeberou se sloupce 60 až 79 z každého řádku.

Platí pro