private bool ScrollIntoView(Rectangle rect, bool paint)
{
// If the item does not fully it into the clipping (visible rect)
if ((rect.Right > _viewClipRect.Right) ||
(rect.Left < _viewClipRect.Left))
{
// If off the right hand side of the area
if (rect.Right > _viewClipRect.Right)
_scrollOffset += (rect.Right - _viewClipRect.Right) + (SCROLL_GAP * 2);
// If off the left hand side of the area
if (rect.Left < _viewClipRect.Left)
_scrollOffset -= (_viewClipRect.Left - rect.Left) + SCROLL_GAP;
// Request a layout with new scroll settings
if (paint)
_needPaintDelegate(this, new NeedLayoutEventArgs(true));
// A change was made to the scroll offset
return true;
}
return false;
}