コード例 #1
0
 private void Window_KeyDown(object sender, KeyEventArgs e)
 {
     //Debug.WriteLine("Window_KeyDown");
     if (e.Key == Key.Delete)
     {
         if (theNeuronArrayView.theSelection.selectedRectangles.Count > 0)
         {
             theNeuronArrayView.DeleteSelection();
             theNeuronArrayView.ClearSelection();
             Update();
         }
         else
         {
             if (theNeuronArray != null)
             {
                 theNeuronArray.Undo();
                 theNeuronArrayView.Update();
             }
         }
     }
     if (e.Key == Key.LeftCtrl || e.Key == Key.RightCtrl)
     {
         ctrlPressed = true;
     }
     if (e.Key == Key.LeftShift || e.Key == Key.RightShift)
     {
         shiftPressed = true;
         theNeuronArrayView.theCanvas.Cursor = Cursors.Hand;
     }
     if (e.Key == Key.Escape)
     {
         if (theNeuronArrayView.theSelection.selectedRectangles.Count > 0)
         {
             theNeuronArrayView.ClearSelection();
             Update();
         }
     }
     if (ctrlPressed && e.Key == Key.C)
     {
         theNeuronArrayView.CopyNeurons();
     }
     if (ctrlPressed && e.Key == Key.V)
     {
         theNeuronArrayView.PasteNeurons();
     }
     if (ctrlPressed && e.Key == Key.X)
     {
         theNeuronArrayView.CutNeurons();
     }
     if (ctrlPressed && e.Key == Key.A)
     {
         MenuItem_SelectAll(null, null);
     }
     if (ctrlPressed && e.Key == Key.M)
     {
         theNeuronArrayView.MoveNeurons();
     }
     if (ctrlPressed && e.Key == Key.Z)
     {
         if (theNeuronArray != null)
         {
             theNeuronArray.Undo();
             theNeuronArrayView.Update();
         }
     }
 }