public void SetCustomColors(Color[][] colors)
{
// Cannot accept an empty argument
if ((colors == null) || (colors.Length == 0))
colors = _noneScheme;
int rows = -1;
for (int i = 0; i < colors.Length; i++)
{
// Each element must contain a valid reference
if (colors[i] == null)
throw new ArgumentOutOfRangeException("Child array cannot be null.");
else
{
// Cache length of first child array
if (i == 0)
rows = colors[i].Length;
else
{
// All other child arrays must be the same length
if (colors[i].Length != rows)
throw new ArgumentOutOfRangeException("Each child color array must be the same length.");
}
}
}
_colors = colors;
}