示例#1
0
        private C2iSymboleSelectionMultiple CreatePanelSelectionMultiple()
        {
            C2iSymboleSelectionMultiple panelSelection = new C2iSymboleSelectionMultiple();

            if (Selection.Count <= 0)
            {
                return(null);
            }
            if (Selection.Count > 1)
            {
                C2iSymbole prevSymbole = (C2iSymbole)Selection[0];
                for (int i = 1; i < Selection.Count; i++)
                {
                    if (prevSymbole.Parent != Selection[i].Parent)
                    {
                        MessageBox.Show(I.T("Impossible to group objects not having the same parent|30031"));
                        return(null);
                    }
                    prevSymbole = (C2iSymbole)Selection[i];
                }
            }
            panelSelection.ForeColor = Color.Transparent;
            panelSelection.BackColor = Color.Transparent;
            Selection[0].Parent.AddChild(panelSelection);
            if (panelSelection.Parent != null)
            {
                panelSelection.Parent.RemoveChild(panelSelection);
            }
            panelSelection.Parent = Selection[0].Parent;
            ArrayList arraySymbole = new ArrayList();
            ArrayList arrayPos     = new ArrayList();

            foreach (C2iSymbole symbole in Selection[0].Parent.Childs)
            {
                if (Selection.Contains(symbole))
                {
                    arraySymbole.Add(symbole);
                    arrayPos.Add(symbole.PositionAbsolue);
                }
            }

            foreach (C2iSymbole symbole in arraySymbole)
            {
                panelSelection.AddChild(symbole);
                if (symbole.Parent != null)
                {
                    symbole.Parent.RemoveChild(symbole);
                }
                symbole.Parent = panelSelection;
                Selection.Remove(symbole);
            }
            for (int i = 0; i < arraySymbole.Count; i++)
            {
                ((C2iSymbole)arraySymbole[i]).PositionAbsolue = (Point)arrayPos[i];
            }

            Refresh();

            return(panelSelection);
        }
示例#2
0
        public void RemovePanelSelectionMultiple()
        {
            ArrayList arrayGroupes = new ArrayList();

            foreach (I2iObjetGraphique objet in Selection)
            {
                if (objet.GetType() == typeof(C2iSymboleSelectionMultiple))
                {
                    arrayGroupes.Add(objet);
                }
            }

            foreach (I2iObjetGraphique objet in arrayGroupes)
            {
                C2iSymboleSelectionMultiple panelSelection = (C2iSymboleSelectionMultiple)objet;
                Selection.Remove(panelSelection);

                C2iSymbole[] tabSymbole = new C2iSymbole[panelSelection.Childs.Length];
                Point[]      tabPos     = new Point[panelSelection.Childs.Length];
                C2iSymbole   objParent  = (C2iSymbole)panelSelection.Parent;
                for (int i = 0; i < panelSelection.Childs.Length; i++)
                {
                    tabSymbole[i] = (C2iSymbole)panelSelection.Childs[i];
                    tabPos[i]     = panelSelection.Childs[i].PositionAbsolue;
                }
                panelSelection.Parent.RemoveChild(panelSelection);
                for (int i = 0; i < tabSymbole.Length; i++)
                {
                    objParent.AddChild(tabSymbole[i]);
                    if (tabSymbole[i].Parent != null)
                    {
                        tabSymbole[i].Parent.RemoveChild(tabSymbole[i]);
                    }
                    tabSymbole[i].Parent = objParent;
                }

                for (int i = 0; i < tabPos.Length; i++)
                {
                    tabSymbole[i].Position        = tabPos[i];
                    tabSymbole[i].PositionAbsolue = tabPos[i];
                }
            }
        }
示例#3
0
        public void AjusterFond()
        {
            Selection.Clear();
            foreach (C2iSymbole symb in ObjetEdite.Childs)
            {
                Selection.Add(symb);
            }

            if (Selection.Count > 1)
            {
                C2iSymboleSelectionMultiple panelGroupe = new C2iSymboleSelectionMultiple();

                panelGroupe = CreatePanelSelectionMultiple();

                if (panelGroupe != null)
                {
                    panelGroupe.Parent   = ObjetEdite;
                    panelGroupe.Position = new Point(0, 0);

                    Size newSize = panelGroupe.Size;
                    Selection.Add(panelGroupe);

                    RemovePanelSelectionMultiple();

                    ObjetEdite.Size = newSize;
                    Selection.Clear();
                }
            }
            else if (Selection.Count == 1)
            {
                Selection[0].Position = new Point(0, 0);
                Size newSize = new Size(Selection[0].Size.Width + 2, Selection[0].Size.Height + 2);
                ObjetEdite.Size = newSize;
                Selection.Clear();
            }
        }