c# datagridview笔记

禁止用户改变DataGridView1的所有列的列宽
DataGridView1.AllowUserToResizeColumns = false;

禁止用户改变DataGridView1所有行的行高
DataGridView1.AllowUserToResizeRows = false;

绘制panel border

private void panel_Paint(object sender, PaintEventArgs e)
{
  Panel p = (Panel)sender;
  ControlPaint.DrawBorder(e.Graphics, p.ClientRectangle,
  Color.LightGray, 1, ButtonBorderStyle.Solid,
  Color.LightGray, 1, ButtonBorderStyle.Solid,
  Color.LightGray, 1, ButtonBorderStyle.Solid,
  Color.LightGray, 1, ButtonBorderStyle.Solid);
}

原文地址:https://www.cnblogs.com/sherlock-merlin/p/13572026.html