Table of Contents

Class ControlBounds

Namespace
SharpConsoleUI.Layout
Assembly
SharpConsoleUI.dll

Represents the complete bounds and coordinate information for a control within a window

public class ControlBounds
Inheritance
ControlBounds
Inherited Members

Constructors

ControlBounds(IWindowControl, Window)

Initializes a new instance of the ControlBounds class.

public ControlBounds(IWindowControl control, Window parentWindow)

Parameters

control IWindowControl

The control these bounds apply to.

parentWindow Window

The window containing this control.

Exceptions

ArgumentNullException

Thrown when control or parentWindow is null.

Properties

Control

The control these bounds apply to

public IWindowControl Control { get; }

Property Value

IWindowControl

ControlContentBounds

The actual control rendering area (excluding margins, padding)

public Rectangle ControlContentBounds { get; set; }

Property Value

Rectangle

HasInternalScrolling

Whether the control supports internal scrolling

public bool HasInternalScrolling { get; set; }

Property Value

bool

IsVisible

Whether the control is currently visible within the window viewport

public bool IsVisible { get; set; }

Property Value

bool

ParentWindow

The window containing this control

public Window ParentWindow { get; }

Property Value

Window

ScrollOffset

Current scroll offset within the control content

public Point ScrollOffset { get; set; }

Property Value

Point

ViewportSize

The viewport size available for control content (considering scrollbars)

public Size ViewportSize { get; set; }

Property Value

Size

WindowContentBounds

Total area allocated to the control within the window content area (including margins)

public Rectangle WindowContentBounds { get; set; }

Property Value

Rectangle

Methods

ControlToViewport(Point)

Converts a control-local position to viewport-relative coordinates

public Point ControlToViewport(Point controlPosition)

Parameters

controlPosition Point

Returns

Point

ControlToWindow(Point)

Converts a control-local position to window coordinates (including borders)

public Point ControlToWindow(Point controlPosition)

Parameters

controlPosition Point

Returns

Point

ControlToWindowContent(Point)

Converts a position from control-local coordinates to window content coordinates

public Point ControlToWindowContent(Point controlPosition)

Parameters

controlPosition Point

Returns

Point

GetVisibleContentBounds()

Gets the visible portion of the control within the window

public Rectangle GetVisibleContentBounds()

Returns

Rectangle

IsPositionVisible(Point)

Checks if a control-local position is within the visible viewport

public bool IsPositionVisible(Point controlPosition)

Parameters

controlPosition Point

Returns

bool

WindowContentToControl(Point)

Converts a position from window content coordinates to control-local coordinates

public Point WindowContentToControl(Point windowContentPosition)

Parameters

windowContentPosition Point

Returns

Point

WindowToControl(Point)

Converts a window coordinate (including borders) to control-local coordinates

public Point WindowToControl(Point windowPosition)

Parameters

windowPosition Point

Returns

Point