Console.SetBufferSize Method (Int32, Int32)


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


Type: System.Int32

The width of the buffer area measured in columns.

Type: System.Int32

The height of the buffer area measured in rows.

Exception Condition

height or width is less than or equal to zero.


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


width is less than WindowLeft + WindowWidth.


height is less than WindowTop + WindowHeight.


The user does not have permission to perform this action.


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.


for modifying safe top-level windows and subwindows. Associated enumeration: UIPermissionWindow.SafeTopLevelWindows

.NET Framework
Available since 2.0
Return to top