不同 groupBox 中的 textBox 之间的背对背 Tab 键顺序

Back-to-back tab order between textBoxes in different groupBoxes

是否可以获取以下 Tab 键顺序(according to the numbers in the textBoxes)

我已经尝试为 groupBox 设置相同的 tabIndex,但它仍然在到达 groupBox2 之前跳过 groupBox1 中的所有文本框。

一种可以强制使用 Tab 键顺序的方法是覆盖 Tab 键。

    protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
    {
            switch (keyData)
            {
                case Keys.Tab:
                  if (txtBox1.Focused)
                  {
                      txtBox2.Focus();
                      return;
                  }
                  else if (txtBox2.Focused)
                  {
                      txtBox3.Focus();
                      return;
                  }
                  else if (txtBox3.Focused)
                  {
                      txtBox4.Focus();
                      return;
                  }
                  else if (txtBox4.Focused)
                  {
                      txtBox1.Focus();
                      return;
                  }
                    return base.ProcessCmdKey(ref msg, keyData);
            }
            return base.ProcessCmdKey(ref msg, keyData);
        }

现在,如果您原来的 post 的意思是根据用户在框中输入的内容更改 Tab 键顺序,那就有点棘手了。