private void DrawSplitIndicator(Point newPoint)
{
if (_drawIndicator)
{
if (_movementPoint == _nullPoint)
{
// If there is nothing old to remove...
if (newPoint != _nullPoint)
{
// And there is something new to show, then just draw it
DrawSplitIndicator(SplitRectangleFromPoint(newPoint));
}
}
else if (newPoint == _nullPoint)
{
// If there is nothing new to draw...
if (_movementPoint != _nullPoint)
{
// And there is something old still showing, then remove it
DrawSplitIndicator(SplitRectangleFromPoint(_movementPoint));
}
}
else if (_movementPoint != newPoint)
{
// There is a delta change to draw based on the orientation
if (_separatorOrientation == Orientation.Vertical)
{
// Find the absolute different in positions
int delta = Math.Abs(_movementPoint.X - newPoint.X);
// If they do not actually overlap...
if (delta >= Target.ClientWidth)
{
// Then we just remove the old indicator and draw the new one
DrawSplitIndicator(SplitRectangleFromPoint(_movementPoint));
DrawSplitIndicator(SplitRectangleFromPoint(newPoint));
}
else
{
// Draw the areas that do not overlap
DrawSplitIndicator(SplitRectangleFromPoint(_movementPoint, newPoint.X - _movementPoint.X));
DrawSplitIndicator(SplitRectangleFromPoint(new Point(_movementPoint.X + Target.ClientWidth, _movementPoint.Y), newPoint.X - _movementPoint.X));
}
}
else
{
// Find the absolute different in positions
int delta = Math.Abs(_movementPoint.Y - newPoint.Y);
// If they do not actually overlap...
if (delta >= Target.ClientHeight)
{
// Then we just remove the old indicator and draw the new one
DrawSplitIndicator(SplitRectangleFromPoint(_movementPoint));
DrawSplitIndicator(SplitRectangleFromPoint(newPoint));
}
else
{
// Draw the areas that do not overlap
DrawSplitIndicator(SplitRectangleFromPoint(_movementPoint, newPoint.Y - _movementPoint.Y));
DrawSplitIndicator(SplitRectangleFromPoint(new Point(_movementPoint.X, _movementPoint.Y + Target.ClientHeight), newPoint.Y - _movementPoint.Y));
}
}
}
}
// Remember the point used for last draw cycle
_movementPoint = newPoint;
}