windows mobile C# net3.5 上下键移动焦点事件

private void TextBoxUpDown_KeyDown(object sender, KeyEventArgs e)
{
Control ctl = (Control)sender;
if (e.KeyCode == Keys.Down)
{
  if (ctl.TabIndex == 7)
  {
    tabControl1.SelectedIndex = 1;
    cbModify.Focus();
    this.SelectNextControl(this, true, true, true, true);
     return;
  }
  this.SelectNextControl(ctl, true, true, true, true);
}
if (e.KeyCode == Keys.Up)
{
  if (ctl.TabIndex == 9)
  {
    tabControl1.SelectedIndex = 0;
    cbModify.Focus();
    this.SelectNextControl(this, true, true, true, true);
    return;
  }
  this.SelectNextControl(ctl, false, true, true, true);
}

posted @ 2012-02-06 10:56  cntom  阅读(237)  评论(0编辑  收藏  举报