Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
SetBufferSize Method

Console.SetBufferSize Method

Sets the height and width of the screen buffer area to the specified values.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

static member SetBufferSize : 
        width:int * 
        height:int -> unit

Parameters

width
Type: System.Int32

The width of the buffer area measured in columns.

height
Type: System.Int32

The height of the buffer area measured in rows.

ExceptionCondition
ArgumentOutOfRangeException

height or width is less than or equal to zero.

-or-

height or width is greater than or equal to Int16.MaxValue.

-or-

width is less than WindowLeft + WindowWidth.

-or-

height is less than WindowTop + WindowHeight.

SecurityException

The user does not have permission to perform this action.

IOException

An I/O error occurred.

The following example demonstrates the WindowLeft, WindowTop, WindowWidth, WindowHeight, BufferWidth, BufferHeight, and CursorVisible properties; and the SetWindowPosition, SetBufferSize, and ReadKey methods. The example draws a grid pattern in the screen buffer based on the screen buffer width. Then the example moves the console window in response to which of the UP ARROW, DOWN ARROW, LEFT ARROW, or RIGHT ARROW console keys is pressed. The grid pattern helps you see the movement of the console window relative to the screen buffer.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Show:
© 2015 Microsoft