title: How to determine node on TreeView on Mouse and Key event
body: <p>I have a <code>System.Windows.Forms.TreeView</code>. The user can navigate it with the mouse or keyboard. I have event handlers for both.
  The mouse click event works well, but I have a problem in that the <code>KeyEventArg</code> has no knowledge of the nodes in the tree (as does <code>TreeNodeMouseClickEventArgs</code>).
  So how does the code know where the user is in the TreeView when using the up and down keys?</p>
  
  <p>MyView.Designer.cs</p>
  
  <pre><code>this.trvApproval.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.trvApproval_NodeMouseClick);
  this.trvApproval.KeyUp += new System.Windows.Forms.KeyEventHandler(this.trvApproval_KeyUp);
  </code></pre>
  
  <p>MyView.cs</p>
  
  <pre><code>private void trvApproval_NodeMouseClick(object sender, System.Windows.Forms.TreeNodeMouseClickEventArgs eventArgs)
  {
      this.trvApproval.SelectedNode = eventArgs.Node;
  }
  
  private void trvApproval_KeyUp(object sender, System.Windows.Forms.KeyEventArgs eventArgs)
  {
      // No knowledge of tree in KeyEventArgs
      if (eventArgs.KeyValue == Convert.ToChar(Keys.Down))
      {
          System.Diagnostics.Trace.WriteLine("trvApproval_KeyPress Down: " + eventArgs.KeyValue);
      }
      else if (eventArgs.KeyValue == Convert.ToChar(Keys.Up))
      {
          System.Diagnostics.Trace.WriteLine("trvApproval_KeyPress Up: " + eventArgs.KeyValue);
      }
  }
  </code></pre>