예제 #1
0
        public static bool PositionnePorts(CTypeEquipement typeEquipement)
        {
            if (typeEquipement == null)
            {
                return(false);
            }
            C2iSymbole symbole       = new C2iSymbole();
            C2iSymbole symboleTypeEq = typeEquipement.SymboleADessinerSansPorts;

            if (symboleTypeEq != null)
            {
                symbole.Size = symboleTypeEq.Size;
                C2iSymboleVerrouille verrou = new C2iSymboleVerrouille();
                verrou.SymboleContenu = symboleTypeEq;
                verrou.LockPosition   = true;
                verrou.LockSize       = true;
                symbole.AddChild(verrou);
                verrou.Parent = symbole;
            }
            foreach (CPort port in typeEquipement.Ports)
            {
                C2iSymbolePort symbolePort = new C2iSymbolePort();
                symbolePort.Port = port;
                symbole.AddChild(symbolePort);
                symbolePort.Parent = symbole;
            }
            CFormEditeurSymbolePopup.EditeSymbole(symbole, typeEquipement.GetType(), true);
            return(true);
        }
예제 #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];
                }
            }
        }