Struct LayoutSize
- Namespace
- SharpConsoleUI.Layout
- Assembly
- SharpConsoleUI.dll
Represents a size with width and height dimensions. Immutable value type for layout calculations. Named LayoutSize to avoid conflicts with System.Drawing.Size during transition.
public readonly record struct LayoutSize : IEquatable<LayoutSize>
- Implements
- Inherited Members
Constructors
LayoutSize(int, int)
Represents a size with width and height dimensions. Immutable value type for layout calculations. Named LayoutSize to avoid conflicts with System.Drawing.Size during transition.
public LayoutSize(int Width, int Height)
Parameters
Properties
Height
public int Height { get; init; }
Property Value
Infinite
Gets a size with maximum possible dimensions.
public static LayoutSize Infinite { get; }
Property Value
IsEmpty
Gets whether this size has zero area.
public bool IsEmpty { get; }
Property Value
Width
public int Width { get; init; }
Property Value
Zero
Gets a size with zero width and height.
public static LayoutSize Zero { get; }
Property Value
Methods
Clamp(LayoutSize, LayoutSize)
Returns a new size clamped between minimum and maximum bounds.
public LayoutSize Clamp(LayoutSize min, LayoutSize max)
Parameters
minLayoutSizemaxLayoutSize
Returns
Constrain(LayoutSize)
Returns a new size with both dimensions constrained to the specified size.
public LayoutSize Constrain(LayoutSize max)
Parameters
maxLayoutSize
Returns
Constrain(int, int)
Returns a new size with both dimensions constrained to the specified maximums.
public LayoutSize Constrain(int maxWidth, int maxHeight)
Parameters
Returns
Expand(LayoutSize)
Returns a new size expanded to at least the specified size.
public LayoutSize Expand(LayoutSize min)
Parameters
minLayoutSize
Returns
Expand(int, int)
Returns a new size expanded to at least the specified minimums.
public LayoutSize Expand(int minWidth, int minHeight)
Parameters
Returns
FromDrawingSize(Size)
Creates from System.Drawing.Size.
public static LayoutSize FromDrawingSize(Size size)
Parameters
sizeSize
Returns
ToDrawingSize()
Converts to System.Drawing.Size.
public Size ToDrawingSize()
Returns
ToString()
Returns a string representation of this size.
public override string ToString()
Returns
WithMaxHeight(int)
Returns a new size with the height constrained to the specified maximum.
public LayoutSize WithMaxHeight(int maxHeight)
Parameters
maxHeightint
Returns
WithMaxWidth(int)
Returns a new size with the width constrained to the specified maximum.
public LayoutSize WithMaxWidth(int maxWidth)
Parameters
maxWidthint