設置DdtaGridView控件中網格線的樣式
阿新 • • 發佈:2018-12-31
bubuko idc com mco pub GridView public set sender
實現效果:
知識運用:
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; }
設置DdtaGridView控件中網格線的樣式