DataGridView 的 buttoncell 如何設定 button 的背景色?
不是cell 的背景色,想知道如何設定按鈕的背景色?
------解决方案--------------------例如:
private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.ColumnIndex == 0)
{
e.Handled = true;
using (SolidBrush brush = new SolidBrush(Color.Green))
{
e.Graphics.FillRectangle(brush, e.CellBounds);
}
ControlPaint.DrawBorder(e.Graphics, e.CellBounds, Color.Yellow, ButtonBorderStyle.Outset);
}
}