private void PointGrid_MouseMove(object sender, MouseEventArgs e)
{
if (!e.LeftButton.Equals(MouseButtonState.Pressed))
return;
if (_currentPoint == null)
return;
int x = (int)e.GetPosition(PointGrid).X - MyPoint.WIDTH / 2;
int y = (int)e.GetPosition(PointGrid).Y - MyPoint.HEIGHT / 2;
if (x < _currentPoint.X || x > _currentPoint.X + MyPoint.WIDTH ||
y < _currentPoint.Y || y > _currentPoint.Y + MyPoint.HEIGHT)
{
Cell tmp = _currentPoint.CurrentCell;
_currentPoint.SetNewLocation(tmp.X, tmp.Y);
}
_currentPoint.SetNewLocation(x, y);
}