ForcePointToBeWithinMargins
(
Point oPoint
)
{
AssertValid();
Double dX = oPoint.X;
Double dY = oPoint.Y;
Rect oGraphRectangleMinusMargin = this.GraphRectangleMinusMargin;
dX = Math.Max(dX, oGraphRectangleMinusMargin.Left);
dX = Math.Min(dX, oGraphRectangleMinusMargin.Right);
dY = Math.Max(dY, oGraphRectangleMinusMargin.Top);
dY = Math.Min(dY, oGraphRectangleMinusMargin.Bottom);
return ( new Point(dX, dY) );
}