Table of Contents

Class BufferTextExtensions

Namespace
SharpConsoleUI.Drawing
Assembly
SharpConsoleUI.dll

Extension methods for text alignment and word wrapping on CharacterBuffer.

public static class BufferTextExtensions
Inheritance
BufferTextExtensions
Inherited Members

Methods

WriteStringCentered(CharacterBuffer, int, string, Color, Color, LayoutRect?)

Writes horizontally centered text within the clip region at the specified Y position.

public static void WriteStringCentered(this CharacterBuffer buffer, int y, string text, Color fg, Color bg, LayoutRect? clipRect = null)

Parameters

buffer CharacterBuffer
y int
text string
fg Color
bg Color
clipRect LayoutRect?

WriteStringInBox(CharacterBuffer, LayoutRect, string, BoxChars, Color, Color, Color, Color, LayoutRect?)

Draws a box and writes centered text inside it. The text is centered both horizontally and vertically within the box interior.

public static void WriteStringInBox(this CharacterBuffer buffer, LayoutRect rect, string text, BoxChars boxChars, Color fg, Color bg, Color boxFg, Color boxBg, LayoutRect? clipRect = null)

Parameters

buffer CharacterBuffer
rect LayoutRect
text string
boxChars BoxChars
fg Color
bg Color
boxFg Color
boxBg Color
clipRect LayoutRect?

WriteStringRight(CharacterBuffer, int, string, Color, Color, LayoutRect?)

Writes right-aligned text within the clip region at the specified Y position.

public static void WriteStringRight(this CharacterBuffer buffer, int y, string text, Color fg, Color bg, LayoutRect? clipRect = null)

Parameters

buffer CharacterBuffer
y int
text string
fg Color
bg Color
clipRect LayoutRect?

WriteWrappedText(CharacterBuffer, int, int, int, string, Color, Color, LayoutRect?)

Writes word-wrapped text starting at the given position within the specified width. Words that exceed the available width are broken across lines.

public static void WriteWrappedText(this CharacterBuffer buffer, int x, int y, int width, string text, Color fg, Color bg, LayoutRect? clipRect = null)

Parameters

buffer CharacterBuffer
x int
y int
width int
text string
fg Color
bg Color
clipRect LayoutRect?