Exemple #1
0
 /// <summary>
 /// Constructs a sheet by calling <see cref="M:Northwoods.Go.GoSheet.CreatePaper" />,
 /// <see cref="M:Northwoods.Go.GoSheet.CreateBackgroundImage" />, and <see cref="M:Northwoods.Go.GoSheet.CreateGrid" />.
 /// </summary>
 public GoSheet()
 {
     base.Initializing = true;
     myPaper           = CreatePaper();
     Add(myPaper);
     myBackgroundImage = CreateBackgroundImage();
     Add(myBackgroundImage);
     myGrid = CreateGrid();
     Add(myGrid);
     myLeft = MakeBoundary();
     Add(myLeft);
     myRight = MakeBoundary();
     Add(myRight);
     myTop = MakeBoundary();
     Add(myTop);
     myBottom = MakeBoundary();
     Add(myBottom);
     base.Initializing = false;
     LayoutChildren(null);
 }
Exemple #2
0
        /// <summary>
        /// Update the internal reference fields when a child object is removed.
        /// </summary>
        /// <param name="obj"></param>
        public override bool Remove(GoObject obj)
        {
            bool result = base.Remove(obj);

            if (obj == myPaper)
            {
                myPaper = null;
                return(result);
            }
            if (obj == myBackgroundImage)
            {
                myBackgroundImage = null;
                return(result);
            }
            if (obj == myGrid)
            {
                myGrid = null;
                return(result);
            }
            if (obj == myLeft)
            {
                myLeft = null;
                return(result);
            }
            if (obj == myRight)
            {
                myRight = null;
                return(result);
            }
            if (obj == myTop)
            {
                myTop = null;
                return(result);
            }
            if (obj == myBottom)
            {
                myBottom = null;
            }
            return(result);
        }
Exemple #3
0
        /// <summary>
        /// When resizing the <see cref="F:Northwoods.Go.GoBalloon.AnchorHandle" />, call
        /// <see cref="M:Northwoods.Go.GoBalloon.PickNewAnchor(System.Drawing.PointF,Northwoods.Go.GoView,Northwoods.Go.GoInputState)" /> to consider other objects as anchors for this balloon.
        /// </summary>
        /// <param name="view"></param>
        /// <param name="origRect"></param>
        /// <param name="newPoint"></param>
        /// <param name="whichHandle"></param>
        /// <param name="evttype"></param>
        /// <param name="min"></param>
        /// <param name="max"></param>
        /// <remarks>
        /// <para>
        /// <see cref="M:Northwoods.Go.GoBalloon.PickNewAnchor(System.Drawing.PointF,Northwoods.Go.GoView,Northwoods.Go.GoInputState)" /> is called each time this method is called,
        /// as long as the handle is <see cref="F:Northwoods.Go.GoBalloon.AnchorHandle" />.
        /// The implementation of <see cref="M:Northwoods.Go.GoBalloon.PickNewAnchor(System.Drawing.PointF,Northwoods.Go.GoView,Northwoods.Go.GoInputState)" /> will actually set <see cref="P:Northwoods.Go.GoBalloon.Anchor" />
        /// when <paramref name="evttype" /> is <see cref="F:Northwoods.Go.GoInputState.Finish" />.
        /// </para>
        /// <para>
        /// Instead of reusing the resizing mechanism to reanchor a balloon,
        /// we may replace this mechanism with a separate reanchoring tool,
        /// if the need for more flexibility becomes apparent.
        /// </para>
        /// </remarks>
        public override void DoResize(GoView view, RectangleF origRect, PointF newPoint, int whichHandle, GoInputState evttype, SizeF min, SizeF max)
        {
            if (whichHandle == 1026)
            {
                switch (evttype)
                {
                case GoInputState.Start:
                    break;

                case GoInputState.Continue:
                    if (myTemporaryAnchor == null)
                    {
                        GoObject goObject = new GoRectangle();
                        PointF   pointF   = ComputeAnchorPoint();
                        goObject.Bounds   = new RectangleF(pointF.X, pointF.Y, 0f, 0f);
                        myTemporaryAnchor = goObject;
                    }
                    myTemporaryAnchor.Position = newPoint;
                    PickNewAnchor(newPoint, view, evttype);
                    UpdateRoute();
                    break;

                case GoInputState.Finish:
                    myTemporaryAnchor = null;
                    PickNewAnchor(newPoint, view, evttype);
                    UpdateRoute();
                    break;

                case GoInputState.Cancel:
                    myTemporaryAnchor = null;
                    PickNewAnchor(newPoint, view, evttype);
                    break;
                }
            }
            else
            {
                base.DoResize(view, origRect, newPoint, whichHandle, evttype, min, max);
            }
        }