/// <summary> /// Opens forms for editing the selected color scheme /// </summary> private void btnEdit_Click(object sender, EventArgs e) { ColorBlend blend = (listBox1.SelectedItem as ColorBlend); if (blend == null) { return; } blend = CloneColorBlend(blend); ColorSchemeForm form = new ColorSchemeForm(blend); if (form.ShowDialog(this) == DialogResult.OK) { listBox1.Items[listBox1.SelectedIndex] = form._blend; listBox1.Refresh(); } form.Dispose(); RefreshControls(); }
/// <summary> /// Adds the new color scheme to the list, and opens editing form to start it's editing /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { ColorBlend blend = new ColorBlend(2); blend.Colors[0] = Color.White; blend.Colors[1] = Color.Black; blend.Positions[0] = 0.0f; blend.Positions[1] = 1.0f; ColorSchemeForm form = new ColorSchemeForm(blend); if (form.ShowDialog(this) == DialogResult.OK) { listBox1.Items.Add(form._blend); listBox1.SelectedIndex = listBox1.Items.Count - 1; DrawColorBlend(listBox1.SelectedItem as ColorBlend); } form.Dispose(); RefreshControls(); }