public void UpdateControlPoints(PixelFarm.Agg.SvgPart svgPath)
        {
            //1. we remove existing point from root

            _svgPath = svgPath;
            VertexStore vxs = svgPath.GetVxs();

            int m = _controls.Count;

            for (int n = 0; n < m; ++n)
            {
                _controls[n].RemoveSelf();
            }
            _controls.Clear(); //***
            _points.Clear();

            //2. create new control points...

            int j = vxs.Count;

            for (int i = 0; i < j; ++i)
            {
                var cmd = vxs.GetVertex(i, out double x, out double y);
                switch (cmd)
                {
                case PixelFarm.Agg.VertexCmd.MoveTo:
                {
                    var ctrlPoint = new UIControllerBox(8, 8);
                    ctrlPoint.Index = i;
                    ctrlPoint.SetLocation((int)x, (int)y);
                    SetupCornerBoxController(ctrlPoint);
                    _controls.Add(ctrlPoint);
                    _simpleBox.AddChild(ctrlPoint);
                }
                break;

                case PixelFarm.Agg.VertexCmd.LineTo:
                {
                    var ctrlPoint = new UIControllerBox(8, 8);
                    ctrlPoint.Index = i;
                    ctrlPoint.SetLocation((int)x, (int)y);
                    SetupCornerBoxController(ctrlPoint);
                    _controls.Add(ctrlPoint);
                    _simpleBox.AddChild(ctrlPoint);
                }
                break;

                case PixelFarm.Agg.VertexCmd.Close:
                    break;
                }
            }
        }
Beispiel #2
0
 public void AddItem(TreeNode treeNode)
 {
     treeNode.SetLocation(0, latestItemY);
     latestItemY += treeNode.Height;
     treeNode.SetOwnerTreeView(this);
     panel.AddChild(treeNode);
 }
Beispiel #3
0
 public void SetGridView(GridView gridView)
 {
     _gridView = gridView;
     _scrollableViewPanel.AddChild(gridView);
 }
Beispiel #4
0
 //----------------------------------------------------
 public void AddItem(ListItem ui)
 {
     items.Add(ui);
     panel.AddChild(ui);
 }
        public void Init()
        {
            //------------
            controllerBox1 = new UIControllerBox(40, 40);
            {
                Color c = KnownColors.FromKnownColor(KnownColor.Yellow);
                controllerBox1.BackColor = new Color(100, c.R, c.G, c.B);
                controllerBox1.SetLocation(200, 200);
                //controllerBox1.dbugTag = 3;
                controllerBox1.Visible = false;
                SetupControllerBoxProperties(controllerBox1);
                //viewport.AddContent(controllerBox1);
                _controls.Add(controllerBox1);
            }
            _simpleBox.AddChild(controllerBox1);
            //------------

            _boxLeftTop = new UIControllerBox(20, 20);
            SetupCornerBoxController(_boxLeftTop);
            _boxLeftTop.MouseDrag += (s1, e1) =>
            {
                //move other boxes ...
                UIBox target1 = _boxLeftTop.TargetBox;
                //update target
                target1.SetLocationAndSize(_boxLeftTop.Right,
                                           _boxLeftTop.Bottom,
                                           _boxRightTop.Left - _boxLeftTop.Right,
                                           _boxRightBottom.Top - _boxLeftTop.Bottom);
                //update other controller
                UpdateControllerBoxes(target1);
            };
            _simpleBox.AddChild(_boxLeftTop);
            //------------
            _boxLeftBottom = new UIControllerBox(20, 20);
            SetupCornerBoxController(_boxLeftBottom);
            _boxLeftBottom.MouseDrag += (s1, e1) =>
            {
                UIBox target1 = _boxLeftBottom.TargetBox;
                //update target
                target1.SetLocationAndSize(_boxLeftBottom.Right,
                                           _boxLeftTop.Bottom,
                                           _boxRightTop.Left - _boxLeftBottom.Right,
                                           _boxLeftBottom.Top - _boxLeftTop.Bottom);
                //update other controller
                UpdateControllerBoxes(target1);
            };
            _simpleBox.AddChild(_boxLeftBottom);
            //------------

            _boxRightTop = new UIControllerBox(20, 20);
            SetupCornerBoxController(_boxRightTop);
            _boxRightTop.MouseDrag += (s1, e1) =>
            {
                UIBox target1 = _boxRightTop.TargetBox;
                //update target
                target1.SetLocationAndSize(_boxLeftTop.Right,
                                           _boxRightTop.Bottom,
                                           _boxRightTop.Left - _boxLeftTop.Right,
                                           _boxRightBottom.Top - _boxRightTop.Bottom);
                //update other controller
                UpdateControllerBoxes(target1);
            };
            _simpleBox.AddChild(_boxRightTop);

            //------------
            _boxRightBottom = new UIControllerBox(20, 20);
            SetupCornerBoxController(_boxRightBottom);
            _boxRightBottom.MouseDrag += (s1, e1) =>
            {
                UIBox target1 = _boxRightBottom.TargetBox;
                //update target
                target1.SetLocationAndSize(_boxLeftTop.Right,
                                           _boxLeftTop.Bottom,
                                           _boxRightBottom.Left - _boxLeftTop.Right,
                                           _boxRightBottom.Top - _boxLeftTop.Bottom);
                //update other controller
                UpdateControllerBoxes(target1);
            };
            _simpleBox.AddChild(_boxRightBottom);
        }