示例#1
0
        /// <summary>
        /// Opens forms for editing the selected color scheme
        /// </summary>
        private void btnEdit_Click(object sender, EventArgs e)
        {
            var blend = (_listBox1.SelectedItem as ColorBlend);

            if (blend == null)
            {
                return;
            }
            blend = CloneColorBlend(blend);

            using (var form = new ColorSchemeForm(blend))
            {
                if (_context.View.ShowChildView(form, this))
                {
                    _listBox1.Items[_listBox1.SelectedIndex] = form.Blend;
                    _listBox1.Refresh();
                }
            }

            RefreshControls();
        }
示例#2
0
        /// <summary>
        /// Adds the new color scheme to the list, and opens editing form to start it's editing
        /// </summary>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var blend = new ColorBlend(2);

            blend.Colors[0] = Color.White;
            blend.Colors[1] = Color.Black;

            blend.Positions[0] = 0.0f;
            blend.Positions[1] = 1.0f;

            using (var form = new ColorSchemeForm(blend))
            {
                if (_context.View.ShowChildView(form, this))
                {
                    _listBox1.Items.Add(form.Blend);
                    _listBox1.SelectedIndex = _listBox1.Items.Count - 1;
                    DrawColorBlend(_listBox1.SelectedItem as ColorBlend);
                }
            }

            RefreshControls();
        }