PDA

View Full Version : خبر: تغییر رنگ سطرهای متوالی در DataGridView



ali_2021
سه شنبه 19 خرداد 1388, 13:20 عصر
Color bg = Color.White;
foreach (DataGridViewRow dgvr in dataGridView.Rows)
{
DataGridViewCellStyle dgvcs = new DataGridViewCellStyle();
dgvcs.BackColor = bg;
foreach(DataGridViewCell dgvc in dgvr.Cells)
{
dgvc.Style = dgvcs;
}
bg = (bg == Color.White) ? Color.Yellow : Color.White;
}

منبع : www.utter.blogfa.com

NewFoxStudent
سه شنبه 19 خرداد 1388, 16:24 عصر
Color bg = Color.White;
foreach (DataGridViewRow dgvr in dataGridView.Rows)
{
DataGridViewCellStyle dgvcs = new DataGridViewCellStyle();
dgvcs.BackColor = bg;
foreach(DataGridViewCell dgvc in dgvr.Cells)
{
dgvc.Style = dgvcs;
}
bg = (bg == Color.White) ? Color.Yellow : Color.White;
}


ممکنه توضیح بدید این چیکار میکنه
ممنونم