2 hnxiawq hnxiawq 于 2017.09.04 15:06 提问

DataGridView控件中,怎么实现回车之后光标往右边移?

DataGridView控件中,怎么实现回车之后光标往右边移?

1个回答

csdn4652
csdn4652   2017.09.04 15:14

1 触发按enter事件
protected override void WndProc ( ref Message m )
{
//如果m.Msg的值为0x0312那么表示用户按下了热键
const int WM_HOTKEY = 0x0312;

        switch (m.Msg)
        {
            case WM_HOTKEY:
                switch (m.WParam.ToInt32 ( ))
                {
                    case 110:
                        xxx( );
                        break;
                    default:
                        break;


                }
                break;
        }
        base.WndProc ( ref m );

                    2 光标右移
                    public void xxx()
                    {
                    this.dgv.seletedcell=this.dgv.rows[this.dgv.seletedcell.rowindex].cells[this.dgv.seletedcell.colimuindex];
                    }
Csdn user default icon
上传中...
上传图片
插入图片