Condividi tramite


PSHostRawUserInterface.GetBufferContents(Rectangle) Method

Definition

Extracts a rectangular region of the screen buffer.

public:
 abstract cli::array <System::Management::Automation::Host::BufferCell, 2> ^ GetBufferContents(System::Management::Automation::Host::Rectangle rectangle);
public abstract System.Management.Automation.Host.BufferCell[,] GetBufferContents (System.Management.Automation.Host.Rectangle rectangle);
abstract member GetBufferContents : System.Management.Automation.Host.Rectangle -> System.Management.Automation.Host.BufferCell[,]
Public MustOverride Function GetBufferContents (rectangle As Rectangle) As BufferCell(,)

Parameters

rectangle
Rectangle

The rectangle on the screen buffer to extract.

Returns

An array of BufferCell objects extracted from the rectangular region of the screen buffer specified by rectangle

Remarks

If the rectangle is completely outside of the screen buffer, a BufferCell array of zero rows and column will be returned.

If the rectangle is partially outside of the screen buffer, the area where the screen buffer and rectangle overlap will be read and returned. The size of the returned array is the same as that of r. Each BufferCell in the non-overlapping area of this array is set as follows:

Character is the space (' ') ForegroundColor to the current foreground color, given by the ForegroundColor property of this class. BackgroundColor to the current background color, given by the BackgroundColor property of this class.

The resulting array is organized in row-major order for performance reasons. The screen buffer, however, is organized in column-major order -- e.g. you specify the column index first, then the row index second, as in (x, y). This means that a cell at screen buffer position (x, y) is in the array element [y, x].

Applies to

See also