示例#1
0
        public void Group(object sender, EventArgs e)
        {
            if (_selectedObjs.Count > 1)
            {
                //需要排序,否则绘图的先后顺序会发生改变
                int[] indexA = new int[_selectedObjs.Count];
                for (int i = 0; i < indexA.Length; i++)
                {
                    indexA[i] = Objs.IndexOf(_selectedObjs[i]);
                }
                Array.Sort(indexA);
                List <IDrawObj> groupL = indexA.Select(t => Objs[t]).ToList();
                DrawGroup       group  = new DrawGroup(groupL);
                _nameManager.CreateName(group);
                group.Layer = DefaultLayer;
                group.LoadInitializationEvent();

                foreach (IDrawObj obj in _selectedObjs)
                {
                    Objs.Remove(obj);
                }
                Objs.Insert(indexA[0], group);
                _selectedObjs.Clear();
                if (group.CanSelect())
                {
                    _selectedObjs.Add(group);
                }

                _controlPoint.ChangeSelectObj(_selectedObjs);
                Container.Invalidate();
            }
        }
示例#2
0
        /// <summary>
        /// 合并
        /// </summary>
        public void Combine()
        {
            if (_selectedObjs.Count > 1)
            {
                //需要排序,否则绘图的先后顺序会发生改变
                int[] indexA = new int[_selectedObjs.Count];
                for (int i = 0; i < indexA.Length; i++)
                {
                    indexA[i] = Objs.IndexOf(_selectedObjs[i]);
                }
                Array.Sort(indexA);

                DrawCombine draw = new DrawCombine(_selectedObjs)
                {
                    Parant = Container
                };
                _nameManager.CreateName(draw);
                draw.Layer = DefaultLayer;
                draw.LoadInitializationEvent();

                foreach (IDrawObj obj in _selectedObjs)
                {
                    Objs.Remove(obj);
                }
                Objs.Insert(indexA[0], draw);
                _selectedObjs.Clear();
                if (draw.CanSelect())
                {
                    _selectedObjs.Add(draw);
                }

                _controlPoint.ChangeSelectObj(_selectedObjs);
                Container.Invalidate();
            }
        }
示例#3
0
        public void Last(object sender, EventArgs e)
        {
            IDrawObj obj = _selectedObjs[0];

            Objs.Remove(obj);
            Objs.Insert(0, obj);
            obj.Invalidate();
        }
示例#4
0
        public void Back(object sender, EventArgs e)
        {
            IDrawObj obj   = _selectedObjs[0];
            int      index = Objs.IndexOf(obj);

            if (index > 0)
            {
                Objs.Remove(obj);
                Objs.Insert(index - 1, obj);
                obj.Invalidate();
            }
        }
示例#5
0
        public void Front(object sender, EventArgs e)
        {
            IDrawObj obj   = _selectedObjs[0];
            int      index = Objs.IndexOf(obj);

            if (index != Objs.Count - 1)
            {
                Objs.Remove(obj);
                Objs.Insert(index + 1, obj);
                obj.Invalidate();
            }
        }