Beispiel #1
0
        ///-------------------------------------------------------------------------------------------------
        /// \fn public override void ShowAsSelected()
        ///
        /// \brief Shows as selected
        ///-------------------------------------------------------------------------------------------------

        public override void ShowAsSelected()
        {
            base.ShowAsSelected();
            PictureBox pictureBox = MainWin.GetInstance().MainView();
            int        sumx = 0, sumy = 0;

            for (int i = 0; i < pointArray.Count; i++)
            {
                Point        pointtemp = pointArray[i];
                AdjustButton temp      = new AdjustButton(
                    pictureBox, this, new Point(pointtemp.X - 3, pointtemp.Y - 3), Cursors.SizeNS);
                adjustButtons.Add(temp);

                temp.MouseDown += AdjustButton_MouseDown;
                temp.MouseUp   += AdjustButton_MouseUp;
                temp.MouseMove += AdjustButton_MouseMove;

                sumx += pointtemp.X;
                sumy += pointtemp.Y;
            }

            //set moveButton attributes
            moveButton = new MoveButton(pictureBox, this,
                                        new Point(sumx / pointArray.Count, sumy / pointArray.Count),
                                        Cursors.SizeAll
                                        );
            moveButton.MouseDown += MoveButton_MouseDown;
            moveButton.MouseMove += MoveButton_MouseMove;
            moveButton.MouseUp   += MoveButton_MouseUp;

            Log.LogText("Select BSpline");
        }
Beispiel #2
0
        ///-------------------------------------------------------------------------------------------------
        /// \fn public override void ShowAsSelected()
        ///
        /// \brief Shows as selected
        ///-------------------------------------------------------------------------------------------------

        public override void ShowAsSelected()
        {
            base.ShowAsSelected();
            if (resizeButton == null)
            {
                resizeButton = new AdjustButton(MainWin.GetInstance().MainView(), this, new Point(endPoint.X - 3, endPoint.Y - 3), Cursors.SizeNS);
                resizeButton.SetBindingPoints(
                    new Ref <Point>(() => endPoint, z => { endPoint = z; })
                    );
                resizeButton.MouseDown += ResizeButton_MouseDown;
                resizeButton.MouseUp   += ResizeButton_MouseUp;
                resizeButton.MouseMove += ResizeButton_MouseMove;

                moveButton = new MoveableButtonWithDoubleBuffering(MainWin.GetInstance().MainView(), this, new Point(startPoint.X - 3, startPoint.Y - 3), Cursors.SizeAll);
                moveButton.SetBindingPoints(
                    new Ref <Point>(() => startPoint, z => { startPoint = z; }),
                    new Ref <Point>(() => endPoint, z => { endPoint = z; }),
                    new Ref <Point>(() => resizeButton.Location, z => { resizeButton.Location = z; })
                    );
                moveButton.MouseDown += MoveButton_MouseDown;
                moveButton.MouseUp   += MoveButton_MouseUp;
                moveButton.MouseMove += MoveButton_MouseMove;
            }
            Log.LogText("Select Circle");
        }
Beispiel #3
0
        ///-------------------------------------------------------------------------------------------------
        /// \fn public void ShowAsResizing()
        ///
        /// \brief Shows as resizing
        ///-------------------------------------------------------------------------------------------------

        public void ShowAsResizing()
        {
            resizeRect = new ResizeRect(MainWin.GetInstance().MainView(), ExternalRectangle(), this);
            resizeRect.NEButton.MouseDown += NEButton_MouseDown;
            resizeRect.NEButton.MouseMove += NEButton_MouseMove;
            resizeRect.NEButton.MouseUp   += NEButton_MouseUp;
        }
Beispiel #4
0
        ///-------------------------------------------------------------------------------------------------
        /// \fn public override void ShowAsSelected()
        ///
        /// \brief Shows as selected
        ///-------------------------------------------------------------------------------------------------

        public override void ShowAsSelected()
        {
            base.ShowAsSelected();
            if (adjustButton == null)
            {
                adjustButton = new AdjustButton(MainWin.GetInstance().MainView(), this,
                                                Common.RotatingPoint(new Point(rect.Right, rect.Top), midPoint, angle),
                                                Cursors.SizeNS);
                adjustButton.MouseDown += AdjustButton_MouseDown;
                adjustButton.MouseUp   += AdjustButton_MouseUp;
                adjustButton.MouseMove += AdjustButton_MouseMove;
            }
            if (moveButton == null)
            {
                moveButton = new MoveButton(MainWin.GetInstance().MainView(),
                                            this,
                                            Common.RotatingPoint(new Point(rect.Left + rect.Width / 2, rect.Top + rect.Height / 2), midPoint, angle),
                                            Cursors.SizeAll);
                moveButton.MouseDown += MoveButton_MouseDown;
                moveButton.MouseMove += MoveButton_MouseMove;
                moveButton.MouseUp   += MoveButton_MouseUp;
                moveButton.SetBindingPoints(
                    new Ref <Point>(() => rect.Location, z => { rect.Location = Common.RotatingPoint(z, midPoint, -angle); }),
                    new Ref <Point>(() => adjustButton.Location, z => { adjustButton.Location = z; })
                    );
            }
            Log.LogText(string.Format("Select Ellipse ({0},{1}),({2},{3})", rect.Left, rect.Top, rect.Right, rect.Bottom));
        }
Beispiel #5
0
        ///-------------------------------------------------------------------------------------------------
        /// \fn public override void ShowAsSelected()
        ///
        /// \brief Shows as selected
        ///-------------------------------------------------------------------------------------------------

        public override void ShowAsSelected()
        {
            base.ShowAsSelected();
            if (adjustButtonA == null)
            {
                adjustButtonA            = new AdjustButton(MainWin.GetInstance().MainView(), this, new Point(a.X - 3, a.Y - 3), Cursors.SizeNS);
                adjustButtonA.MouseDown += ResizeButtonA_MouseDown;
                adjustButtonA.MouseUp   += ResizeButtonA_MouseUp;
                adjustButtonA.MouseMove += ResizeButtonA_MouseMove;
            }
            if (adjustButtonB == null)
            {
                adjustButtonB            = new AdjustButton(MainWin.GetInstance().MainView(), this, new Point(b.X - 3, b.Y - 3), Cursors.SizeNS);
                adjustButtonB.MouseDown += ResizeButtonA_MouseDown;
                adjustButtonB.MouseUp   += ResizeButtonA_MouseUp;
                adjustButtonB.MouseMove += ResizeButtonA_MouseMove;
            }
            if (moveButton == null)
            {
                moveButton = new MoveButton(MainWin.GetInstance().MainView(),
                                            this, new Point(a.X / 2 + b.X / 2, a.Y / 2 + b.Y / 2),
                                            Cursors.SizeAll);
                moveButton.MouseDown += MoveButton_MouseDown;
                moveButton.MouseMove += MoveButton_MouseMove;
                moveButton.MouseUp   += MoveButton_MouseUp;
            }

            adjustButtonA.SetBindingPoints(
                new Ref <Point>(() => a, z => { a = z; })
                );
            adjustButtonB.SetBindingPoints(
                new Ref <Point>(() => b, z => { b = z; })
                );
            moveButton.SetBindingPoints(
                new Ref <Point>(() => a, z => { a = z; }),
                new Ref <Point>(() => b, z => { b = z; }),
                // only lines'point moving is not enough. We need move its buttons.
                new Ref <Point>(() => adjustButtonA.Location, z => { adjustButtonA.Location = z; }),
                new Ref <Point>(() => adjustButtonB.Location, z => { adjustButtonB.Location = z; })
                );

            Log.LogText("Select Line");
        }