Console.BufferWidth Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient ou définit la largeur de la zone de mémoire tampon.
public:
static property int BufferWidth { int get(); void set(int value); };
public static int BufferWidth { [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 BufferWidth { [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] get; [System.Runtime.Versioning.SupportedOSPlatform("windows")] set; }
public static int BufferWidth { 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 BufferWidth : int with get, set
[<get: System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
[<set: System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member BufferWidth : int with get, set
static member BufferWidth : int with get, set
Public Shared Property BufferWidth As Integer
Valeur de propriété
Largeur actuelle, dans les colonnes, de la zone tampon.
- Attributs
Exceptions
La valeur d’une opération set est inférieure ou égale à zéro.
- ou -
La valeur d’une opération set est supérieure ou égale à Int16.MaxValue.
- ou -
La valeur d’une opération set est inférieure à WindowLeft + WindowWidth.
L'utilisateur n'est pas autorisé à effectuer cette action.
Une erreur d’E/S s’est produite.
L’opération set est appelée sur un système d’exploitation autre que Windows.
Exemples
Cet exemple illustre les propriétés et BufferWidth les BufferHeight propriétés. L’exemple signale les dimensions d’une fenêtre du système d’exploitation définie sur une taille de mémoire tampon de 300 lignes et 85 colonnes.
// 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.
'
Remarques
Si une opération définie diminue la valeur de la BufferWidth propriété, les colonnes les plus à droite sont supprimées. Par exemple, si le nombre de colonnes est réduit de 80 à 60, les colonnes 60 à 79 de chaque ligne sont supprimées.