private void CreateColorRamp(double value, Color color) { ColorChoose ctl = new ColorChoose(value, color); ctl.Height = 21; ctl.Width = 354; ctl.TabIndex = _index; ctl.Dock = DockStyle.Top; this.panel2.Controls.Add(ctl); _index--; }
private void btnOk_Click(object sender, EventArgs e) { List <ColorRamp> temp = new List <ColorRamp>(); foreach (Control ctl in panel2.Controls) { ColorChoose color = ctl as ColorChoose; temp.Add(new ColorRamp() { value = color.ColorValue, A = color.SelectColor.A, R = color.SelectColor.R, G = color.SelectColor.G, B = color.SelectColor.B }); } _colors.MyRamps = temp.ToArray(); XmlHelper.Serialize <ColorRamps>(_colors, _path); DialogResult = DialogResult.OK; }