winform的DataGridView中如何设置当前单元格的背景色,默认当前单元格所到之处都为蓝色,如何改为其它色。

解决方案 »

  1.   

    DataGridViewCellStyle RowStyle = new DataGridViewCellStyle();
                RowStyle.BackColor = Color.AliceBlue;
                RowStyle.ForeColor = Color.Black;
                RowStyle.SelectionBackColor = Color.AliceBlue;
                RowStyle.SelectionForeColor = Color.Black;
      

  2.   

    属性菜单里不是有个DefaultCellstyle,你在那个里面设selectionBackColor就是改单元格的。DefaultRowstyle可以改变每行的,方法和DefaultCellstyle一样.
      

  3.   

    DataGridViewCellStyle RowStyle = new DataGridViewCellStyle();
    RowStyle.BackColor = Color.AliceBlue;