#region " Higlighing maximum value
"
DataGridViewRow
dgvRow = (DataGridViewRow)dgvMemberAccuracy.Rows[dgvMemberAccuracy.Rows.Count
- 1];
foreach
(DataGridViewCell dgvCell in dgvRow.Cells)
{
if (dgvCell.OwningColumn.Index > 2 )
{
object oTotal = dgvMemberAccuracy.Rows.Cast<DataGridViewRow>()
.Where(r => (r.Cells[dgvCell.OwningColumn.Index].Value != DBNull.Value &&
r.Cells[dgvCell.OwningColumn.Index].Value != null
&& r.Index != dgvRow.Index))
.Max(t => t.Cells[dgvCell.OwningColumn.Index].Value);
if (oTotal != null)
{
decimal dTotal = Convert.ToDecimal(oTotal);
Array arrTemp = (dgvMemberAccuracy.Rows.Cast<DataGridViewRow>()
.Where(r =>
(r.Cells[dgvCell.OwningColumn.Index].Value != DBNull.Value)
&& r.Index != dgvRow.Index &&
r.Cells[dgvCell.OwningColumn.Index].Value.ToString() == dTotal.ToString())
.ToArray());
foreach
(DataGridViewRow dgr in arrTemp)
{
dgvMemberAccuracy.Rows[dgr.Index].Cells[dgvCell.OwningColumn.Index].Style.BackColor
= Color.Green;
}
}
}
}
#endregion " Higlighing maximum value "
No comments:
Post a Comment