Console.BufferWidth Egenskap

Definition

Hämtar eller anger bredden på buffertområdet.

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

Egenskapsvärde

Den aktuella bredden, i kolumner, för buffertområdet.

Attribut

Undantag

Värdet i en uppsättningsåtgärd är mindre än eller lika med noll.

-eller-

Värdet i en uppsättningsåtgärd är större än eller lika med Int16.MaxValue.

-eller-

Värdet i en uppsättningsåtgärd är mindre än WindowLeft + WindowWidth.

Användaren har inte behörighet att utföra den här åtgärden.

Ett I/O-fel uppstod.

Set-åtgärden anropas på ett annat operativsystem än Windows.

Exempel

Det här exemplet visar BufferHeight egenskaperna och BufferWidth . Exemplet rapporterar dimensionerna för ett operativsystemfönster inställt på en buffertstorlek på 300 rader och 85 kolumner.

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

Kommentarer

Om en uppsättningsåtgärd minskar värdet för BufferWidth egenskapen tas kolumnerna längst till höger bort. Om till exempel antalet kolumner minskas från 80 till 60 tas kolumnerna 60 till 79 av varje rad bort.

Gäller för