Posted 8 February 2022, 11:57 pm EST
I am using flexgrid with about 1000 rows and I have set the row highlight color to light blue. I want to change the fore color of the rows when a column equals to “Faulty” or “Obsolete”. Am able to do that using owner draw event but problem is the flexgrid becomes very slow.
Am using this code in the owner draw:
foreach (Row r in photomaticGrid.Rows)
{
if (r[13].ToString().Equals("Faulty") && e.Row == r.Index &&
e.Col != 1 && e.Row > 0)
{
CellStyle nc = photomaticGrid.Styles.Add("Faulty");
nc.ForeColor = Color.FromArgb(137, 70, 166);
e.Style = nc;
}
if (r[13].ToString().Equals("Obsolete") && e.Row == r.Index &&
e.Col != 1 && e.Row > 0)
{
CellStyle nc = photomaticGrid.Styles.Add("Obsolete");
nc.ForeColor = Color.FromArgb(206, 18, 18);
e.Style = nc;
}
}