コード例 #1
0
 private void ColumnShortcut_KeyPressEvent(object sender, CellKeyPressEventArgs args)
 {
     if (args.Editing && KeyShortcuts.CombinationValidForItem(args.EventKey))
     {
         currentKey      = new AccelKey(args.EventKey.Key, args.EventKey.State, AccelFlags.Visible);
         args.Entry.Text = KeyShortcuts.KeyToString(currentKey);
         args.MarkAsHandled();
     }
     switch (args.EventKey.Key)
     {
     case Key.BackSpace:
     case Key.Delete:
         currentKey      = AccelKey.Zero;
         args.Entry.Text = string.Empty;
         break;
     }
     gridNavigator.ColumnKeyPress(args, args.Cell.Column, ShortcutColumnEvaluate, ShortcutColumnEditPrev, ShortcutColumnEditNext);
 }
コード例 #2
0
        private bool ShortcutColumnEvaluate(int row, string value)
        {
            bool combinationValid = KeyShortcuts.CombinationValidForItem(currentKey) || currentKey.Key == 0;

            if (!combinationValid || row >= itemShortcuts.Count)
            {
                return(false);
            }

            if (!UsedInMenu(row))
            {
                return(false);
            }

            if (!UsedWithAnotherItem(row))
            {
                return(false);
            }

            itemShortcuts [row].Shortcut = currentKey;
            return(true);
        }