Exemple #1
0
        /// <summary>
        /// This method is called repeatedly by <see cref="M:Northwoods.Go.GoBalloon.DoResize(Northwoods.Go.GoView,System.Drawing.RectangleF,System.Drawing.PointF,System.Int32,Northwoods.Go.GoInputState,System.Drawing.SizeF,System.Drawing.SizeF)" /> while
        /// the user is dragging the <see cref="F:Northwoods.Go.GoBalloon.AnchorHandle" /> resize handle.
        /// </summary>
        /// <param name="p">the point (in document coordinates) currently specified by the user's mouse</param>
        /// <param name="view"></param>
        /// <param name="evttype"></param>
        /// <remarks>
        /// When <paramref name="evttype" /> is <c>GoInputState.</c><see cref="F:Northwoods.Go.GoInputState.Finish" />,
        /// this calls <see cref="M:Northwoods.Go.GoView.PickObject(System.Boolean,System.Boolean,System.Drawing.PointF,System.Boolean)" /> to
        /// find the selectable document object at the given point <paramref name="p" />.
        /// The <see cref="P:Northwoods.Go.GoBalloon.Anchor" /> is set to that object.
        /// If no object is found at that point, the <see cref="P:Northwoods.Go.GoBalloon.Anchor" /> is set to null
        /// and the <see cref="P:Northwoods.Go.GoBalloon.UnanchoredOffset" /> is set to the offset between that
        /// point and the <see cref="P:Northwoods.Go.GoComment.Label" />'s Position.
        /// If the user tries to reanchor this balloon to itself, no change is made.
        /// This method does nothing unless the <paramref name="evttype" /> is <see cref="F:Northwoods.Go.GoInputState.Finish" />.
        /// </remarks>
        protected virtual void PickNewAnchor(PointF p, GoView view, GoInputState evttype)
        {
            if (evttype != GoInputState.Finish)
            {
                return;
            }
            GoObject goObject = view.PickObject(doc: true, view: false, p, selectableOnly: true);

            if (goObject == this)
            {
                return;
            }
            Anchor = goObject;
            if (goObject == null)
            {
                if (Label != null)
                {
                    UnanchoredOffset = GoTool.SubtractPoints(p, Label.Position);
                }
                else
                {
                    UnanchoredOffset = GoTool.SubtractPoints(p, base.Position);
                }
            }
        }