Table of Contents

Method EnsureVisible

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

EnsureVisible(ref PointD, RectD, bool)

Adjusts the specified position to ensure that the associated rectangle is fully visible within the given container bounds.

public virtual void EnsureVisible(ref PointD position, RectD containerBounds, bool adjustLine = true)

Parameters

position PointD

A reference to the position of the top-left corner of the rectangle. This value may be adjusted to ensure visibility.

containerBounds RectD

The bounds of the container within which the rectangle must be visible.

adjustLine bool

A boolean value indicating whether to adjust the position vertically to account for additional spacing, such as line height. Defaults to true.

Remarks

This method ensures that the rectangle, defined by the specified position and its size, is fully contained within the provided container bounds. If the rectangle extends beyond the container bounds, the position is adjusted to bring it back into view. Additionally, if the rectangle intersects with an excluded area, alternative positions are suggested to avoid the excluded area while maintaining visibility within the container bounds.