winform中dataGridView可以做到
设置cell的 readOnly=true;即可

解决方案 »

  1.   

    很難控制﹐不過可以在CurrentCellChanged事件中控制(一定要有TableStyle)﹐
    將需要設為ReadOnly的單元格保存在數組中﹐然后判斷﹕
    例﹕
    ArrayList Cells=new ArrayList();
    Cells.Add(new DataGridCell(2,3));
    Cells.Add(new DataGridCell(5,4));
    //下面的在CurrentCellChanged的事件中添加
    if(Cells.IndexOf(Grid.CurrentCell)>-1)
    Grid.TableStyles[0].GridColumnStyles[Grid.CurrentCell.ColumnNumber].ReadOnly=true;
    else
    Grid.TableStyles[0].GridColumnStyles[Grid.CurrentCell.ColumnNumber].ReadOnly=false;
      

  2.   

    在cellbeginedit事件中取消(cancle=true)