Example #1
0
 private List<ColorSpot> GetColorPalette()
 {
     var spots = new ColorSpot[dataGridColors.Rows.Count];
     for (int i = 0; i < dataGridColors.Rows.Count; i++)
     {
         DataGridViewRow row = dataGridColors.Rows[i];
         spots[i] = new ColorSpot
         {
             Color = (row.Cells[2].Value as String ?? "").ToColor(),
             Point =
                 new Point((row.Cells[0].Value ?? "").ToString().ToInt(),
                                        (row.Cells[1].Value ?? "").ToString().ToInt()),
             IsBackgroundColor = (bool)(row.Cells[3].Value ?? false)
         };
     }
     return spots.Where(x => !x.Color.IsEmpty).ToList();
 }