private void lvEffects_ItemChecked(object sender, ItemCheckedEventArgs e) { if (e.Item != null && e.Item.Tag is ImageEffect) { ImageEffect imageEffect = (ImageEffect)e.Item.Tag; imageEffect.Enabled = e.Item.Checked; UpdatePreview(); } }
private void AddSelectedEffect() { TreeNode node = tvEffects.SelectedNode; if (node != null && node.Tag is Type) { Type type = (Type)node.Tag; ImageEffect imageEffect = (ImageEffect)Activator.CreateInstance(type); AddEffect(imageEffect); UpdatePreview(); } }
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(); } }
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(); } } }
private void AddEffect(ImageEffect imageEffect) { ListViewItem lvi = new ListViewItem(imageEffect.GetType().GetDescription()); 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; }