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);
}

posted @ 2020-08-27 16:07  sherlock-merlin  阅读(138)  评论(0编辑  收藏  举报