this.dataGridView1.Rows.Clear(); int index = 0; for (int i = 0; i < 5; i++) { index = dataGridView1.Rows.Add(); dataGridView1[id.Index, index].Value = i + 1; dataGridView1[name.Index, index].Value ="小米"+ i;
dataGridView1[age.Index, index].Value = 18 + i;
DataGridViewCellStyle style1 = new DataGridViewCellStyle(); Font f1 = new Font("宋体", 13, FontStyle.Regular); style1.Font = f1; dataGridView1[name.Index, index].Style = style1; }
能给个例子看看吗 小弟刚学没多久之前一直弄JAVA的
int index = 0;
for (int i = 0; i < 5; i++)
{
index = dataGridView1.Rows.Add();
dataGridView1[id.Index, index].Value = i + 1;
dataGridView1[name.Index, index].Value ="小米"+ i;
dataGridView1[age.Index, index].Value = 18 + i;
DataGridViewCellStyle style1 = new DataGridViewCellStyle();
Font f1 = new Font("宋体", 13, FontStyle.Regular);
style1.Font = f1;
dataGridView1[name.Index, index].Style = style1;
}
style1.ForeColor = Color.Red;
这个是设置成红色
这个是设置成红色<span class='red'>数据</span>这个是在服务器设置好的,不能在本地固定