Tag: 圆圈

在C#Winforms中的DataGridViewCell内绘制一个实心圆或矩形

我想在DataGridViewCell的中心绘制一个小圆圈。 矩形也可以做到这一点。 我假设我必须在CellPainting事件中这样做。 我试过这个: if (e.RowIndex >= 0 && e.ColumnIndex >= 0) { if (dgv_Cuotas.Columns[e.ColumnIndex].Name == “Seleccionar” && Convert.ToBoolean(dgv_Cuotas.Rows[e.RowIndex].Cells[“pagada”].Value) == true) { e.CellStyle.BackColor = Color.LightGray; ; e.PaintBackground(e.ClipBounds, true); e.Handled = true; } } 它绘制了整个单元格,我只想要一个小圆圈或矩形,如下图所示: 我怎样才能做到这一点? 使用DataGridViewImageCell不是一个选项,因为我有格式错误。 我只能将DataGridViewCheckBoxCell更改为DataGridViewTextboxCell。 编辑:我可以将其更改为DataGridViewImageCell !! 不知道之前发生了什么,但我仍然无法在那里加载图像。 我只得到一个带红叉的白色方块(无图像图标)。 这是我的代码: dgv_Cuotas.Rows[row.Index].Cells[“Seleccionar”] = new DataGridViewImageCell(); dgv_Cuotas.Rows[row.Index].Cells[“Seleccionar”].Value = Properties.Resources.punto_verde; dgv_Cuotas.Rows[row.Index].Cells[“Seleccionar”].Style.ForeColor = Color.White; dgv_Cuotas.Rows[row.Index].Cells[“Seleccionar”].Style.SelectionForeColor = Color.White;