在Paint事件中写入代码,如下:
private void dataGridView1_Paint(object sender, PaintEventArgs e)
{
DataGridView dgv = (DataGridView)sender;
Pen p =new Pen(Color.FromArgb(23, 34, 65));
e.Graphics.DrawRectangle(p, new Rectangle(0, 0, dgv.Width - 1, dgv.Height - 1));
}
网友评论