Exemple #1
0
        public override void OnMouseUp(MouseEventArgs e)
        {
            if (selectMode == SelectionMode.NetSelection)
            {
                CC.SelectInRectangle(CC.NetRectangle);
                selectMode            = SelectionMode.None;
                CC.IsDrawNetRectangle = false;
            }
            int dx = (int)(lastPoint.X - startPoint.X);
            int dy = (int)(lastPoint.Y - startPoint.Y);

            if (resizedObject != null)
            {
                resizedObject = null;
            }
            CC.panel.Capture = false;
            CC.panel.Refresh();
        }
Exemple #2
0
        public override void OnMouseDown(MouseEventArgs e)
        {
            CC.isToolPoint = true;

            Point p = new Point(e.X, e.Y);

            selectMode = SelectionMode.None;
            int n = CC.SelectionCount;

            for (int i = n - 1; i >= 0; i--)
            {
                DrawObject w            = CC.GetSelectedObject(i);
                int        handleNumber = w.HitHandleTest(p);
                if (handleNumber > 0)
                {
                    selectMode          = SelectionMode.Size;
                    resizedObject       = w;
                    resizedObjectHandle = handleNumber;
                    CC.UnselectAll();
                    w.Selected = true;
                    break;
                }
            }
            if (selectMode == SelectionMode.None)
            {
                int        n1 = CC.graphicsList.Count;
                DrawObject w  = null;
                //查找是否有对象被选中
                for (int i = n1 - 1; i >= 0; i--)
                {
                    if (CC.graphicsList[i].HitHandleTest(p) == 0)
                    {
                        w = CC.graphicsList[i];
                        break;
                    }
                }
                if (w != null)
                {
                    selectMode = SelectionMode.Move;
                    if ((Control.ModifierKeys & Keys.Control) == 0 && !w.Selected)
                    {
                        CC.UnselectAll();
                    }
                    w.Selected      = true;
                    CC.panel.Cursor = Cursors.SizeAll;
                }
            }
            if (selectMode == SelectionMode.None)
            {
                if ((Control.ModifierKeys & Keys.Control) == 0)
                {
                    CC.UnselectAll();
                }
                selectMode            = SelectionMode.NetSelection;
                CC.IsDrawNetRectangle = true;
            }
            lastPoint.X      = p.X;
            lastPoint.Y      = p.Y;
            startPoint.X     = p.X;
            startPoint.Y     = p.Y;
            CC.panel.Capture = true;
            CC.NetRectangle  = CC.GetNormalizedRectangle(startPoint, lastPoint);
            CC.panel.Refresh();
        }