Exemplo n.º 1
0
        /// <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);

            frmColorScheme form = new frmColorScheme(blend);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                listBox1.Items[listBox1.SelectedIndex] = form._blend;
                listBox1.Refresh();
            }
            form.Dispose();
            RefreshControls();
        }
Exemplo n.º 2
0
        /// <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;

            frmColorScheme form = new frmColorScheme(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();
        }