protected override Point GetExpectedConnectLocationForConnectedAnchor(
            IAnchor anchor, Rectangle oldBounds, Rectangle newBounds
            )
        {
            if (oldBounds == newBounds)
            {
                return(anchor.Location);
            }

            var isMoveOnly = oldBounds.Size == newBounds.Size;

            if (isMoveOnly)
            {
                var locDelta = newBounds.Location - (Size)oldBounds.Location;
                return(anchor.Location + (Size)locDelta);
            }

            var leftDelta   = newBounds.Left - oldBounds.Left;
            var topDelta    = newBounds.Top - oldBounds.Top;
            var rightDelta  = newBounds.Right - oldBounds.Right;
            var bottomDelta = newBounds.Bottom - oldBounds.Bottom;

            var dir = RectUtil.GetDirectionFromCenter(oldBounds, anchor.Location);
            //var dir = RectUtil.GetDirectionStraightlyFromCenter(oldBounds, anchor.Location);
            var newCenter = RectUtil.GetCenter(newBounds);
            var newLoc    = anchor.Location;

            if (EnumUtil.HasAllFlags((int)dir, (int)Directions.Left))
            {
                newLoc.X = Math.Min(newLoc.X + leftDelta, newCenter.X);
            }
            if (EnumUtil.HasAllFlags((int)dir, (int)Directions.Right))
            {
                newLoc.X = Math.Max(newLoc.X + rightDelta, newCenter.X);
            }
            if (EnumUtil.HasAllFlags((int)dir, (int)Directions.Up))
            {
                newLoc.Y = Math.Min(newLoc.Y + topDelta, newCenter.Y);
            }
            if (EnumUtil.HasAllFlags((int)dir, (int)Directions.Down))
            {
                newLoc.Y = Math.Max(newLoc.Y + bottomDelta, newCenter.Y);
            }

            using (_ResourceCache.UseResource()) {
                var path       = _OutlinePathResouce;
                var pts        = path.PathPoints;
                var ptAndDists = new List <Tuple <Point, int> >();
                for (int i = 0, len = pts.Length; i < len; ++i)
                {
                    var pt1 = Point.Round(pts[i]);
                    var pt2 = Point.Round(i + 1 < len ? pts[i + 1] : pts[0]);
                    if (pt1 != pt2)
                    {
                        var pathPortion = new Line(pt1, pt2);
                        var npt         = pathPortion.GetNearestPointFrom(newLoc);
                        var dist        = pathPortion.GetDistance(newLoc);
                        ptAndDists.Add(Tuple.Create(npt, dist));
                    }
                }
                return(ptAndDists.Count == 0? Point.Empty: ptAndDists.FindMin(t => t.Item2).Item1);
            }
        }