private void InitRessources() { m_panelRessourcesMaterielles.SuspendDrawing(); List <CControleAffecteRessourceMaterielle> listeDispo = new List <CControleAffecteRessourceMaterielle>(); foreach (Control ctrl in m_panelRessourcesMaterielles.Controls) { if (ctrl is CControleAffecteRessourceMaterielle) { ctrl.Visible = false; listeDispo.Add((CControleAffecteRessourceMaterielle)ctrl); } } if (Intervention.TypeIntervention != null) { foreach (CContrainte contrainte in Intervention.GetRelationsRessourceAAffecter(typeof(CRessourceMaterielle))) { CControleAffecteRessourceMaterielle ctrl = null; if (listeDispo.Count > 0) { ctrl = listeDispo[0]; listeDispo.RemoveAt(0); } else { ctrl = new CControleAffecteRessourceMaterielle(); m_panelRessourcesMaterielles.Controls.Add(ctrl); } ctrl.Visible = true; ctrl.Init(contrainte, (CRessourceMaterielle)Intervention.GetRessourceMateriellesAssociee(contrainte), Intervention); //m_gestionnaireModeEdition.SetModeEdition(ctrl, TypeModeEdition.EnableSurEdition); ctrl.LockEdition = !m_gestionnaireModeEdition.ModeEdition; ctrl.Dock = DockStyle.Top; ctrl.BringToFront(); } } m_panelRessourcesMaterielles.ResumeDrawing(); }