【发布时间】:2018-10-17 04:37:09
【问题描述】:
我通过将 datagridview 中的单元格背景颜色设置为黄色
`grid.DefaultCellStyle.BackColor = Color.Yellow;`
我看到黄色单元格,但单元格的背面颜色属性不应该也是黄色吗?我得到一个“颜色[空]”而不是黄色。如果我尝试以下代码,为什么颜色不是黄色?
grid.CellClick += new DataGridViewCellEventHandler(
(eventsource, cellevent) =>
{
int rowIndex = cellevent.RowIndex;
int colIndex = cellevent.ColumnIndex;
MessageBox.Show(" color: "+ grid.Rows[rowIndex].Cells[colIndex].Style.BackColor);
});
【问题讨论】:
-
对不起。我是说 Winforms
-
您的问题解决了吗?
标签: c# winforms datagridview colors background