111,131
社区成员
发帖
与我相关
我的任务
分享private void dataGridView1_Paint(object sender, PaintEventArgs e)
{
DataGridViewCell cell = this.dataGridView1.CurrentCell;
if (!this.dataGridView1.ContainsFocus || cell == null)
return;
Rectangle bounds = this.GetCellBounds(cell);
bounds.X += 1;
bounds.Y += 1;
bounds.Width -= 2;
bounds.Height -= 2;
using (Pen pen = new Pen(SystemColors.Highlight))
{
e.Graphics.DrawRectangle(pen, bounds);
}
}
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
this.dataGridView1.Invalidate();
}