Пример #1
0
        protected override bool ProcessKeyPreview(ref Message m)
        {
            if (m.Msg == WM_SYSKEYUP)
            {
                Keys key = (Keys)m.WParam;
                if (key == Keys.Left)
                {
                    CControleListeBesoins ctrl = AssociatedListControl as CControleListeBesoins;
                    if (ctrl != null)
                    {
                        ctrl.DecrementeNiveau(CurrentItem as CItemBesoin);
                        UpdateMarge();
                        ctrl.Refresh();
                        return(true);
                    }
                }
                if (key == Keys.Right)
                {
                    CControleListeBesoins ctrl = AssociatedListControl as CControleListeBesoins;
                    if (ctrl != null)
                    {
                        ctrl.IncrementeNiveau(CurrentItem as CItemBesoin);
                        UpdateMarge();
                        ctrl.Refresh();
                        return(true);
                    }
                }
            }
            if (m.Msg == 0x100)
            {
                Keys key = (Keys)m.WParam;
                if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
                {
                    Type tp = null;
                    if (key.ToString().Length == 1 && m_dicShortKeysToTypeBesoin.TryGetValue(key.ToString().ToUpper()[0], out tp))
                    {
                        ChangeTypeBesoin(tp);
                        return(true);
                    }
                }
            }

            return(base.ProcessKeyPreview(ref m));
        }
Пример #2
0
 //--------------------------------------------------------
 private void m_btnDelete_Click(object sender, EventArgs e)
 {
     if (m_extModeEdition.ModeEdition)
     {
         CControleListeBesoins ctrlListe = AssociatedListControl as CControleListeBesoins;
         if (ctrlListe != null && CurrentItem != null)
         {
             CItemBesoin item = CurrentItem as CItemBesoin;
             if (item != null)
             {
                 if (MessageBox.Show("Supprimer l'élément " +
                                     item.Besoin.Libelle + " ?", "",
                                     MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                 {
                     ctrlListe.RemoveItem(CurrentItem, true);
                 }
             }
         }
     }
 }