RectangleExtensionsEnsureScreen Method

Adjusts the specified rectangle to ensure it is positioned within the given screen's working area.

Definition

Namespace: KGySoft.WinForms
Assembly: KGySoft.WinForms (in KGySoft.WinForms.dll) Version: 5.0.1
C#
public static Rectangle EnsureScreen(
	this Rectangle suggestedBounds,
	Screen screen,
	bool forceSingleScreen
)

Parameters

suggestedBounds  Rectangle
The initial rectangle bounds to be adjusted.
screen  Screen
The screen within which the rectangle should be positioned.
forceSingleScreen  Boolean
to ensure the rectangle is entirely contained within the specified screen if possible; to ensure that the largest part of the rectangle is on the specified screen.

Return Value

Rectangle
The adjusted Rectangle.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Rectangle. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also