//-------------------------------------------------------------- private void m_lnkAjouter_LinkClicked(object sender, EventArgs e) { ContextMenuStrip menu = new ContextMenuStrip(); List <Type> lstTypesIcones = CAllocateurEditeurParametreIconeGantt.GetTousLesTypesDeParametresIconeGanttEditables(); foreach (Type tp in lstTypesIcones.ToArray()) { object[] attribs = tp.GetCustomAttributes(typeof(NomConvivialParametreIconeGanttAttribute), false); if (attribs.Length == 1) { bool present = false; m_dicTypeParametreIcone_presenceControl.TryGetValue(tp, out present); if (((NomConvivialParametreIconeGanttAttribute)attribs[0]).IsUnique && present) { continue; } ToolStripMenuItem item = new ToolStripMenuItem( ((NomConvivialParametreIconeGanttAttribute)attribs[0]).Libelle); item.Tag = tp; Image imgIcone = null; imgIcone = ((IParametreIconeGantt)Activator.CreateInstance(tp)).Image; if (imgIcone != null) { item.Image = imgIcone; } item.Click += new EventHandler(itemAjouterIcone_Click); menu.Items.Add(item); } } menu.Show(m_lnkAjouter, new Point(0, 22)); }
//------------------------------------------------------------------------- public static void AutoExec() { CAllocateurEditeurParametreIconeGantt.RegisterEditeur(typeof(CParametreIconeGanttRetard), typeof(CControlSelectIconeGanttStandard)); CAllocateurEditeurParametreIconeGantt.RegisterEditeur(typeof(CParametreIconeGanttWarning), typeof(CControlSelectIconeGanttStandard)); CAllocateurEditeurParametreIconeGantt.RegisterEditeur(typeof(CParametreIconeGanttTermine), typeof(CControlSelectIconeGanttStandard)); CAllocateurEditeurParametreIconeGantt.RegisterEditeur(typeof(CParametreIconeGanttAuto), typeof(CControlSelectIconeGanttStandard)); }
//---------------------------------------------------------------------- private void AjouterControlIcone(IParametreIconeGantt param) { Type tpIcone = param.GetType(); m_dicTypeParametreIcone_presenceControl[tpIcone] = true; // Ajoute un controle correspondant au type à éditer IEditeurParametreIconeGantt newControl = CAllocateurEditeurParametreIconeGantt.GetEditeurForType(tpIcone); if (newControl != null) { ((Control)newControl).Dock = DockStyle.Top; newControl.DeleteIconeEventHendler += new EventHandler(newControl_DeleteIconeEventHendler); newControl.LockEdition = !m_extModeEdition.ModeEdition; newControl.Init(param); CWin32Traducteur.Translate(newControl); m_panelIcones.Controls.Add((Control)newControl); ((Control)newControl).BringToFront(); } }
//------------------------------------------------------------------------- public static void AutoExec() { CAllocateurEditeurParametreIconeGantt.RegisterEditeur(typeof(CParametreIconeGanttCustom), typeof(CControlSelectIconeGanttCustom)); }