Sdílet prostřednictvím


PSHostRawUserInterface.SetBufferContents Method

Definition

Overloads

SetBufferContents(Coordinates, BufferCell[,])

Copies the BufferCell array into the screen buffer at the given origin, clipping such that cells in the array that would fall outside the screen buffer are ignored.

SetBufferContents(Rectangle, BufferCell)

Copies a given character to all of the character cells in the screen buffer with the indicated colors.

SetBufferContents(Coordinates, BufferCell[,])

Copies the BufferCell array into the screen buffer at the given origin, clipping such that cells in the array that would fall outside the screen buffer are ignored.

public:
 abstract void SetBufferContents(System::Management::Automation::Host::Coordinates origin, cli::array <System::Management::Automation::Host::BufferCell, 2> ^ contents);
public abstract void SetBufferContents (System.Management.Automation.Host.Coordinates origin, System.Management.Automation.Host.BufferCell[,] contents);
abstract member SetBufferContents : System.Management.Automation.Host.Coordinates * System.Management.Automation.Host.BufferCell[,] -> unit
Public MustOverride Sub SetBufferContents (origin As Coordinates, contents As BufferCell(,))

Parameters

origin
Coordinates

The top left corner of the rectangular screen area to which contents is copied.

contents
BufferCell[,]

A rectangle of BufferCell objects to be copied to the screen buffer.

See also

Applies to

SetBufferContents(Rectangle, BufferCell)

Copies a given character to all of the character cells in the screen buffer with the indicated colors.

public:
 abstract void SetBufferContents(System::Management::Automation::Host::Rectangle rectangle, System::Management::Automation::Host::BufferCell fill);
public abstract void SetBufferContents (System.Management.Automation.Host.Rectangle rectangle, System.Management.Automation.Host.BufferCell fill);
abstract member SetBufferContents : System.Management.Automation.Host.Rectangle * System.Management.Automation.Host.BufferCell -> unit
Public MustOverride Sub SetBufferContents (rectangle As Rectangle, fill As BufferCell)

Parameters

rectangle
Rectangle

The rectangle on the screen buffer to which fill is copied. If all elements are -1, the entire screen buffer will be copied with fill.

fill
BufferCell

The character and attributes used to fill rectangle.

Examples

using System;
using System.Management.Automation;
using System.Management.Automation.Host;
namespace Microsoft.Samples.Cmdlet
{
    [Cmdlet("Clear","Screen")]
    public class ClearScreen : PSCmdlet
    {
        protected override void BeginProcessing()
        {
            Host.UI.RawUI.SetBufferContents(new Rectangle(-1, -1, -1, -1),
                new BufferCell(' ', Host.UI.RawUI.ForegroundColor, Host.UI.RawUI.BackgroundColor))
        }
    }
}

Remarks

Provided for clearing regions -- less chatty than passing an array of cells.

See also

Applies to