Beispiel #1
0
        public void UnGroup(object sender, EventArgs e)
        {
            DrawGroup group = null;

            foreach (IDrawObj obj in _selectedObjs)
            {
                if (obj.Type != DrawType.Group)
                {
                    continue;
                }

                group = (DrawGroup)obj;
                group.Ungroup();
                int index = Objs.IndexOf(group);
                Objs.Remove(group);
                Objs.InsertRange(index, group.ObjList);
            }

            if (group != null)
            {
                //去除锁定的控件
                int count = group.ObjList.Count;
                for (int i = count - 1; i >= 0; i--)
                {
                    IDrawObj obj = group.ObjList[i];
                    if (!group.ObjList[i].CanSelect())
                    {
                        group.ObjList.Remove(obj);
                    }
                }

                _selectedObjs.Clear();
                _selectedObjs.AddRange(group.ObjList);

                _controlPoint.ChangeSelectObj(_selectedObjs);
                Container.Invalidate();
            }
        }