本帖最后由 ryanho2008 于 2010-04-12 19:57:46 编辑

解决方案 »

  1.   

    谢谢各位,终于想到了一个办法,原来移动都是keydown的时候触发的,我在keydown那里让handled=true就解决了
      

  2.   

    private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
            {
                 e.Handled = true;
            } private void keyup(object sender, KeyEventArgs ke)
            {
                //ke.Handled = true;
                while (canRead == true)
                {
                    string thekey = "";
                    bool isAlt = ke.Alt;
                    bool isCtrl = ke.Control;
                    bool isShift = ke.Shift;
                    if (isCtrl)
                        thekey += "Control+";
                    if (isAlt)
                        thekey = "Alt+";
                    if (isShift)
                        thekey += "Shift+";
                    thekey += ke.KeyCode.ToString();
                    int row = dataGridView1.CurrentCell.RowIndex;
                    int column = dataGridView1.CurrentCell.ColumnIndex;
                    dataGridView1[column, row].Value = thekey;
                    
                }