共用方式為


PSHostRawUserInterface.NewBufferCellArray Method

Definition

Overloads

NewBufferCellArray(Size, BufferCell)

Same as NewBufferCellArray(Int32, Int32, BufferCell)

NewBufferCellArray(Int32, Int32, BufferCell)

Creates a 2D array of BufferCells by examining contents.Character. PSHostRawUserInterface

NewBufferCellArray(String[], ConsoleColor, ConsoleColor)

Creates a two dimensional array of BufferCells by examining each character in contents.

NewBufferCellArray(Size, BufferCell)

public:
 cli::array <System::Management::Automation::Host::BufferCell, 2> ^ NewBufferCellArray(System::Management::Automation::Host::Size size, System::Management::Automation::Host::BufferCell contents);
public System.Management.Automation.Host.BufferCell[,] NewBufferCellArray (System.Management.Automation.Host.Size size, System.Management.Automation.Host.BufferCell contents);
member this.NewBufferCellArray : System.Management.Automation.Host.Size * System.Management.Automation.Host.BufferCell -> System.Management.Automation.Host.BufferCell[,]
Public Function NewBufferCellArray (size As Size, contents As BufferCell) As BufferCell(,)

Parameters

size
Size

The width and height of the resulting array.

contents
BufferCell

The cell to be copied to each of the elements of the resulting array.

Returns

An array of BufferCells whose size is size and where each cell's value is based on contents

Exceptions

If size.Width or size.Height is less than 1.

See also

Applies to

NewBufferCellArray(Int32, Int32, BufferCell)

Creates a 2D array of BufferCells by examining contents.Character. PSHostRawUserInterface

public:
 cli::array <System::Management::Automation::Host::BufferCell, 2> ^ NewBufferCellArray(int width, int height, System::Management::Automation::Host::BufferCell contents);
public System.Management.Automation.Host.BufferCell[,] NewBufferCellArray (int width, int height, System.Management.Automation.Host.BufferCell contents);
member this.NewBufferCellArray : int * int * System.Management.Automation.Host.BufferCell -> System.Management.Automation.Host.BufferCell[,]
Public Function NewBufferCellArray (width As Integer, height As Integer, contents As BufferCell) As BufferCell(,)

Parameters

width
Int32

The number of columns of the resulting array

height
Int32

The number of rows of the resulting array

contents
BufferCell

The cell to be copied to each of the elements of the resulting array.

Returns

A width by height array of BufferCells where each cell's value is based on contentsbackgroundColor

Exceptions

width is less than 1; height is less than 1.

Remarks

If the character takes one BufferCell to display as determined by LengthInBufferCells, one BufferCell is allocated with its Character set to the character and BufferCellType to BufferCell.Complete. On the other hand, if it takes two BufferCells, two adjacent BufferCells on a row in the returned array will be allocated: the first has Character set to the character and BufferCellType to BufferCellType.Leading and the second Character set to (char)0 and BufferCellType to BufferCellType.Trailing. Moreover, if width is odd, the last column will just contain the leading cell. prototype.BufferCellType is not used in creating the array. The resulting array is suitable for use with the PSHostRawUserInterface.SetBufferContents method.

See also

Applies to

NewBufferCellArray(String[], ConsoleColor, ConsoleColor)

Creates a two dimensional array of BufferCells by examining each character in contents.

public:
 cli::array <System::Management::Automation::Host::BufferCell, 2> ^ NewBufferCellArray(cli::array <System::String ^> ^ contents, ConsoleColor foregroundColor, ConsoleColor backgroundColor);
public System.Management.Automation.Host.BufferCell[,] NewBufferCellArray (string[] contents, ConsoleColor foregroundColor, ConsoleColor backgroundColor);
member this.NewBufferCellArray : string[] * ConsoleColor * ConsoleColor -> System.Management.Automation.Host.BufferCell[,]
Public Function NewBufferCellArray (contents As String(), foregroundColor As ConsoleColor, backgroundColor As ConsoleColor) As BufferCell(,)

Parameters

contents
String[]

String array based on which the two dimensional array of BufferCells will be created.

foregroundColor
ConsoleColor

Foreground color of the buffer cells in the resulting array.

backgroundColor
ConsoleColor

Background color of the buffer cells in the resulting array.

Returns

A two dimensional array of BufferCells whose characters are the same as those in contents and whose foreground and background colors set to foregroundColor and backgroundColor

Exceptions

contents is null; Any string in contents is null or empty

Remarks

If a character C takes one BufferCell to display as determined by LengthInBufferCells, one BufferCell is allocated with its Character set to C and BufferCellType to BufferCell.Complete. On the other hand, if C takes two BufferCell, two adjacent BufferCells on a row in the returned array will be allocated: the first has Character set to C and BufferCellType to Leading and the second Character set to (char)0 and Type to Trailing. Hence, the returned BufferCell array has contents.Length number of rows and number of columns equal to the largest number of cells a string in contents takes. The foreground and background colors of the cells are initialized to foregroundColor and backgroundColor, respectively. The resulting array is suitable for use with SetBufferContents(Rectangle, BufferCell) and System.Management.Automation.Host.PSHostRawUserInterface.SetBufferContents(System.Management.Automation.Host.Coordinates,System.Management.Automation.Host.BufferCell[0:,0:]).

See also

Applies to