【发布时间】:2014-07-05 09:29:59
【问题描述】:
当我在每个将 tabstop 属性设置为 true 的控件上按 向上/向下箭头 时,然后选择 PREVOIUS/NEXT tabindex。它工作正常,但是当 ComboBox 聚焦时,它改变它的值 也会导致它被困箭头。
如何在不将击键发送到 ComboBox 的情况下实现 tabindex 跳转?
处理 tabindex 跳转的代码:
private void ParentForm_KeyDown(object sender, KeyEventArgs e)
{
Control ctl;
ctl = (Control)sender;
if (e.KeyCode == Keys.Down || e.KeyCode == Keys.Enter)
{
ctl.SelectNextControl(ActiveControl, true, true, true, true);
}
else if (e.KeyCode == Keys.Up)
{
ctl.SelectNextControl(ActiveControl, false, true, true, true);
}
}
【问题讨论】:
标签: c# winforms combobox arrow-keys