Table of Contents

Class WindowBounds

Namespace
SharpConsoleUI.Builders
Assembly
SharpConsoleUI.dll

Immutable window bounds information

public sealed record WindowBounds : IEquatable<WindowBounds>
Inheritance
WindowBounds
Implements
Inherited Members

Constructors

WindowBounds(int, int, int, int)

Immutable window bounds information

public WindowBounds(int X, int Y, int Width, int Height)

Parameters

X int

The X coordinate

Y int

The Y coordinate

Width int

The width

Height int

The height

Properties

Bottom

Gets the bottom coordinate

public int Bottom { get; }

Property Value

int

Center

Gets the center point

public Point Center { get; }

Property Value

Point

Height

The height

public int Height { get; init; }

Property Value

int

Left

Gets the left coordinate

public int Left { get; }

Property Value

int

Location

Gets the location

public Point Location { get; }

Property Value

Point

Right

Gets the right coordinate

public int Right { get; }

Property Value

int

Size

Gets the size

public Size Size { get; }

Property Value

Size

Top

Gets the top coordinate

public int Top { get; }

Property Value

int

Width

The width

public int Width { get; init; }

Property Value

int

X

The X coordinate

public int X { get; init; }

Property Value

int

Y

The Y coordinate

public int Y { get; init; }

Property Value

int

Methods

Contains(int, int)

Determines if this bounds contains the specified point

public bool Contains(int x, int y)

Parameters

x int

The X coordinate

y int

The Y coordinate

Returns

bool

True if the point is within these bounds

FromRectangle(Rectangle)

Creates a WindowBounds from a Rectangle

public static WindowBounds FromRectangle(Rectangle rectangle)

Parameters

rectangle Rectangle

The rectangle

Returns

WindowBounds

A WindowBounds instance

IntersectsWith(WindowBounds)

Determines if this bounds intersects with another bounds

public bool IntersectsWith(WindowBounds other)

Parameters

other WindowBounds

The other bounds

Returns

bool

True if the bounds intersect

Offset(int, int)

Creates a new WindowBounds offset by the specified amount

public WindowBounds Offset(int deltaX, int deltaY)

Parameters

deltaX int

The X offset

deltaY int

The Y offset

Returns

WindowBounds

A new WindowBounds instance

ToRectangle()

Converts to a Rectangle

public Rectangle ToRectangle()

Returns

Rectangle

A Rectangle representation

WithPosition(int, int)

Creates a new WindowBounds with the specified position

public WindowBounds WithPosition(int x, int y)

Parameters

x int

The new X coordinate

y int

The new Y coordinate

Returns

WindowBounds

A new WindowBounds instance

WithSize(int, int)

Creates a new WindowBounds with the specified size

public WindowBounds WithSize(int width, int height)

Parameters

width int

The new width

height int

The new height

Returns

WindowBounds

A new WindowBounds instance