RectangleExtensions Class

Provides extension methods for the Rectangle structure.

Definition

Namespace: KGySoft.WinForms
Assembly: KGySoft.WinForms (in KGySoft.WinForms.dll) Version: 5.0.1
C#
public static class RectangleExtensions
Inheritance
Object    RectangleExtensions

Methods

EnsureScreen Adjusts the specified rectangle to ensure it is positioned within the given screen's working area.
FromCenter Creates a Rectangle with the specified center point and size.
GetCenter Gets the center point of the rectangle.
IntersectSafe Like Intersect(Rectangle, Rectangle), but works with big ranges, and returns Empty if the result would be a practically zero rectangle. As a contrast, the Intersect(Rectangle, Rectangle) method can return a non-Empty rectangle with zero Width or Height.
IsEmpty Gets whether the specified Rectangle has zero Width or Height. Not just faster than the IsEmpty property, but also works better when Intersect returns a practically empty non-default rectangle.

See Also