实现效果:
知识运用:
DataGridView控件的GridColor属性 //用来获取或设置网格线的颜色
public Color GridColor { get; set; } //属性值: Color对象或 SystemColors对象
实现代码:
private void Form1_Load(object sender, EventArgs e) { dataGridView1.GridColor = Color.Red; dataGridView1.DataSource = new List<Student>() { new Student(){Age=21,Name="小敏"}, new Student(){Age=33,Name="老臣"}, new Student(){Age=24,Name="小峰"}, new Student(){Age=22,Name="张嘎"}, new Student(){Age=21,Name="半胖"} }; dataGridView1.Columns[0].Width = 150; dataGridView1.Columns[1].Width = 150; }
原文地址:https://www.cnblogs.com/feiyucha/p/10203069.html
时间: 2024-10-13 23:00:56