如题!

解决方案 »

  1.   

    Winform:把DataGrid所在窗口的KeyPreview设置为True.在窗口的KeyDown事件中:
    if(e.KeyCode==Keys.Tab)
    {
    dataGrid1.Focus();
    e.Handled=true;
    }
      

  2.   

    我用代码实现行选:
    dataGrid1.Select(iRow);
    与这么个问题:如果控件已经选择一行了,那么执行这条语句的时候,就会有两行被选中,请问这种问题可以解决吗?
      

  3.   

    除了循环取消选择以外我找不到更好的办法:
    for(int i=0;i<dataGrid1.VisibleRowCount;i++)
    {
    dataGrid1.UnSelect(i);
    }
    dataGrid1.CurrentCell=new DataGridCell(iRow,0);
    dataGrid1.Select(iRow);