ComponentFactory.Krypton.Toolkit.KryptonContextMenuColorColumns.SetCustomColors C# (CSharp) Method

SetCustomColors() public method

Define a custom set of colors for display.
public SetCustomColors ( Color colors ) : void
colors Color An array of color arrays, each of which must be the same length.
return void
        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;
        }