Ejemplo n.º 1
0
        public void Resize(Point dragPoint)
        {
            if (resizeCtrl != null && resizeCtrl.CanResize)
            {
                //Events
                ElementEventArgs eventResizeArg = new ElementEventArgs(resizeCtrl.OwnerElement);
                onElementResizingDelegate(eventResizeArg);

                resizeCtrl.OwnerElement.Invalidate();

                resizeCtrl.Resize(dragPoint);

                ILabelController lblCtrl = ControllerHelper.GetLabelController(resizeCtrl.OwnerElement);
                if (lblCtrl != null)
                {
                    lblCtrl.SetLabelPosition();
                }
                else
                {
                    if (resizeCtrl.OwnerElement is ILabelElement)
                    {
                        LabelElement label = ((ILabelElement)resizeCtrl.OwnerElement).Label;
                        label.PositionBySite(resizeCtrl.OwnerElement);
                    }
                }

                UpdateResizeCorner();
            }
        }
Ejemplo n.º 2
0
        public void EndEdit()
        {
            if (siteLabelElement == null)
            {
                return;
            }

            labelTextBox.KeyPress -= new KeyPressEventHandler(labelTextBox_KeyPress);

            ILabelController lblCtrl = ControllerHelper.GetLabelController(siteLabelElement);

            labelElement.Size = MeasureTextSize();
            labelElement.Text = labelTextBox.Text;
            labelTextBox.Hide();
            if (lblCtrl != null)
            {
                lblCtrl.SetLabelPosition();
            }
            else
            {
                labelElement.PositionBySite(siteLabelElement);
            }
            labelElement.Invalidate();
            siteLabelElement = null;
            labelElement     = null;
            labelTextBox     = null;
        }
Ejemplo n.º 3
0
        public void Move(Point dragPoint)
        {
            //Upper selecion point controller
            Point dragPointEl = dragPoint;

            dragPointEl.Offset(upperSelPointDragOffset.X, upperSelPointDragOffset.Y);

            upperSelPoint = dragPointEl;

            if (dragPointEl.X < 0)
            {
                dragPointEl.X = 0;
            }
            if (dragPointEl.Y < 0)
            {
                dragPointEl.Y = 0;
            }

            //Move Controller
            if (dragPointEl.X == 0)
            {
                dragPoint.X = dragPoint.X - upperSelPoint.X;
            }
            if (dragPointEl.Y == 0)
            {
                dragPoint.Y = dragPoint.Y - upperSelPoint.Y;
            }

            foreach (IMoveController ctrl in moveCtrl)
            {
                if (ctrl != null)
                {
                    ctrl.OwnerElement.Invalidate();

                    onElementMovingDelegate(new ElementEventArgs(ctrl.OwnerElement));

                    ctrl.Move(dragPoint);

                    if (ctrl.OwnerElement is NodeElement)
                    {
                        UpdateLinkPosition((NodeElement)ctrl.OwnerElement);
                    }

                    ILabelController lblCtrl = ControllerHelper.GetLabelController(ctrl.OwnerElement);
                    if (lblCtrl != null)
                    {
                        lblCtrl.SetLabelPosition();
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void UpdateLinkPosition(NodeElement node)
        {
            foreach (ConnectorElement conn in node.Connectors)
            {
                foreach (BaseElement el in conn.Links)
                {
                    BaseLinkElement lnk  = (BaseLinkElement)el;
                    IController     ctrl = ((IControllable)lnk).GetController();
                    if (ctrl is IMoveController)
                    {
                        IMoveController mctrl = (IMoveController)ctrl;
                        if (!mctrl.IsMoving)
                        {
                            lnk.NeedCalcLink = true;
                        }
                    }
                    else
                    {
                        lnk.NeedCalcLink = true;
                    }

                    if (lnk is ILabelElement)
                    {
                        LabelElement label = ((ILabelElement)lnk).Label;

                        ILabelController lblCtrl = ControllerHelper.GetLabelController(lnk);
                        if (lblCtrl != null)
                        {
                            lblCtrl.SetLabelPosition();
                        }
                        else
                        {
                            label.PositionBySite(lnk);
                        }
                        label.Invalidate();
                    }
                }
            }
        }