Table of Contents

Class ControlRenderingHelpers

Namespace
SharpConsoleUI.Helpers
Assembly
SharpConsoleUI.dll

Shared rendering utilities for controls to avoid code duplication. Extracted from 14 controls that had identical margin/padding rendering logic.

public static class ControlRenderingHelpers
Inheritance
ControlRenderingHelpers
Inherited Members

Methods

FillBottomMargin(CharacterBuffer, LayoutRect, LayoutRect, int, Color, Color)

Fills the bottom margin area of a control with the specified background.

public static void FillBottomMargin(CharacterBuffer buffer, LayoutRect bounds, LayoutRect clipRect, int endY, Color foreground, Color background)

Parameters

buffer CharacterBuffer

The character buffer to render to.

bounds LayoutRect

The control's bounding rectangle.

clipRect LayoutRect

The clipping rectangle for rendering.

endY int

The Y coordinate where content ends (margin begins).

foreground Color

The foreground color for the fill character.

background Color

The background color for the fill character.

FillHorizontalMargins(CharacterBuffer, LayoutRect, LayoutRect, int, int, int, Color, Color)

Fills horizontal margins (left and right) for a single line.

public static void FillHorizontalMargins(CharacterBuffer buffer, LayoutRect bounds, LayoutRect clipRect, int y, int contentStartX, int contentWidth, Color foreground, Color background)

Parameters

buffer CharacterBuffer

The character buffer to render to.

bounds LayoutRect

The control's bounding rectangle.

clipRect LayoutRect

The clipping rectangle for rendering.

y int

The Y coordinate of the line to fill margins for.

contentStartX int

The X coordinate where content starts.

contentWidth int

The width of the content area.

foreground Color

The foreground color for the fill character.

background Color

The background color for the fill character.

FillTopMargin(CharacterBuffer, LayoutRect, LayoutRect, int, Color, Color)

Fills the top margin area of a control with the specified background.

public static void FillTopMargin(CharacterBuffer buffer, LayoutRect bounds, LayoutRect clipRect, int startY, Color foreground, Color background)

Parameters

buffer CharacterBuffer

The character buffer to render to.

bounds LayoutRect

The control's bounding rectangle.

clipRect LayoutRect

The clipping rectangle for rendering.

startY int

The Y coordinate where content starts (margin ends).

foreground Color

The foreground color for the fill character.

background Color

The background color for the fill character.