/// <summary> /// 编辑控件KeyDown事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ctlTreeSelect_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F1) { this.m_blnF1 = !this.m_blnF1; } if (this.m_blnF1) { this.ClosePopup(); e.Handled = false; return; } if (e.KeyCode == Keys.Enter && this.IsPopupOpen) { e.Handled = true; this.GetFocusedNodeValue(); } else if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down || e.KeyCode == Keys.Space) { e.Handled = true; if (!this.IsPopupOpen) { this.ShowPopupAndSetFocusedNode(); ctlTreeList.Focus(); } else { ctlTreeList.Focus(); if (e.KeyCode == Keys.Up) { ctlTreeList.MovePrev(); } if (e.KeyCode == Keys.Down) { ctlTreeList.MoveNext(); } } } else if (e.KeyCode != Keys.Enter && e.KeyCode != Keys.Left && e.KeyCode != Keys.Right && e.KeyCode != Keys.Escape) { if (!this.IsPopupOpen) { this.ShowPopupAndSetFocusedNode(); ctlTreeList.Focus(); } } }