日期:2014-05-17 浏览次数:21009 次
private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.ColumnIndex == 0)//索引0
{
e.Handled = true;
using (SolidBrush brush = new SolidBrush(Color.Red))
{
e.Graphics.FillRectangle(brush, e.CellBounds);
}
ControlPaint.DrawBorder(e.Graphics, e.CellBounds, Color.Yellow, ButtonBorderStyle.Outset);
}
if (e.ColumnIndex == 1)//索引1
{
e.Handled = true;
using (SolidBrush brush = new SolidBrush(Color.BlueViolet))
{
e.Graphics.FillRectangle(brush, e.CellBounds);
}