Ejemplo n.º 1
0
        private void tsmiEffectClick(object sender, EventArgs e)
        {
            ToolStripMenuItem tsmi = sender as ToolStripMenuItem;

            if (tsmi != null && tsmi.Tag is Type)
            {
                Type        type        = (Type)tsmi.Tag;
                ImageEffect imageEffect = (ImageEffect)Activator.CreateInstance(type);
                AddEffect(imageEffect);
                UpdatePreview();
            }
        }
Ejemplo n.º 2
0
        private void btnDuplicate_Click(object sender, EventArgs e)
        {
            if (lvEffects.SelectedItems.Count > 0)
            {
                ListViewItem lvi = lvEffects.SelectedItems[0];

                if (lvi.Tag is ImageEffect)
                {
                    ImageEffect imageEffect      = (ImageEffect)lvi.Tag;
                    ImageEffect imageEffectClone = imageEffect.Copy();
                    AddEffect(imageEffectClone);
                    UpdatePreview();
                }
            }
        }
Ejemplo n.º 3
0
        private void AddEffect(ImageEffect imageEffect)
        {
            ListViewItem lvi = new ListViewItem(imageEffect.GetType().GetDescription());

            lvi.Checked = imageEffect.Enabled;
            lvi.Tag     = imageEffect;

            if (lvEffects.SelectedIndices.Count > 0)
            {
                lvEffects.Items.Insert(lvEffects.SelectedIndices[lvEffects.SelectedIndices.Count - 1] + 1, lvi);
            }
            else
            {
                lvEffects.Items.Add(lvi);
            }

            lvEffects.Focus();
            lvi.EnsureVisible();
            lvi.Selected = true;
        }
Ejemplo n.º 4
0
        private void AddEffect(ImageEffect imageEffect)
        {
            ListViewItem lvi = new ListViewItem(imageEffect.GetType().GetDescription());
            lvi.Checked = imageEffect.Enabled;
            lvi.Tag = imageEffect;

            if (lvEffects.SelectedIndices.Count > 0)
            {
                lvEffects.Items.Insert(lvEffects.SelectedIndices[lvEffects.SelectedIndices.Count - 1] + 1, lvi);
            }
            else
            {
                lvEffects.Items.Add(lvi);
            }

            lvEffects.Focus();
            lvi.EnsureVisible();
            lvi.Selected = true;
        }