// This recursively writes the colors private void WriteColors(Control pc) { // Go for all color controls foreach (Control c in pc.Controls) { if (c is ColorControl) { ColorControl cc = (c as ColorControl); // Apply color to palette General.Colors.SetNormalColor(cc.ColorIndex, cc.Color); } WriteColors(c); } }
// This recursively reads the colors private void ReadColors(Control pc) { // Go for all color controls foreach (Control c in pc.Controls) { if (c is ColorControl) { ColorControl cc = (c as ColorControl); // Apply current color to control cc.Color = General.Colors.GetNormalColor(cc.ColorIndex); } ReadColors(c); } }