本帖最后由 chong4r 于 2010-06-03 16:46:01 编辑

解决方案 »

  1.   

    可以的啊!你可以在RowCommon事件中 加
    生成一个随机的单元格,然后加样式
      

  2.   

    this.dataGridView1.CellFormatting += dataGridView1_CellFormatting;
            private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
            {
             
                if(e.RowIndex == dataGridView1.CurrentCell.RowIndex && e.ColumnIndex == dataGridView1.CurrentCell.ColumnIndex)
                {
                    e.CellStyle.SelectionBackColor = Color.DarkBlue;    
                }
                else 
                {
                    e.CellStyle.SelectionBackColor = this.dataGridView1.DefaultCellStyle.SelectionBackColor;
                }
            }设置选中的颜色