private void Form1_Shown(object sender, EventArgs e) { dataGridView1.ClearSelection(); // Fill grid with colors. var colorGenerator = new ColorGenerator(); for (int row = 0; row < Rows; row++) { for (int col = 0; col < Cols; col++) { var color = colorGenerator.GetColor(); // Write colors to trace output. I copy these to the color table in Skyline's // ColorGenerator class. Trace.WriteLine(string.Format("Color.FromArgb({0},{1},{2}),", color.R, color.G, color.B)); dataGridView1.Rows[row].Cells[col].Style.BackColor = color; } } }