DataGridView中按回车键时向后移动后移动,并且指定移动列数

//DataGridView中按回车键时向后移动后移动,并且指定移动列数     --HAO

         protected override bool ProcessCmdKey(ref Message msg, System.Windows.Forms.Keys keyData)
         {
            if (xdgvWorkSignListSave.CurrentCell != null && keyData == Keys.Enter)
            {
                if (xdgvWorkSignListSave.CurrentCell.ColumnIndex < 1)// 1表示只在前两列中移动
                {
                    SendKeys.Send("{Tab}");
                    return true;
                }

                SendKeys.Send("{Down}");
                SendKeys.Send("{Home}");
                return true;
            }
            return base.ProcessCmdKey(ref msg, keyData);
         }

你可能感兴趣的:(DataGridView中按回车键时向后移动后移动,并且指定移动列数)