Exemple #1
0
 /// <summary>
 /// All initialization related code that would upset the Visual Studio designer.
 /// </summary>
 private void UserInitializeComponent()
 {
     foreach (Type t in FilterFramework.FindFilters())
     {
         var menuItem = new ToolStripMenuItem();
         menuItem.Text   = t.Name;
         menuItem.Click += menuItem_Click;
         this.filtersToolStripMenuItem.DropDownItems.Add(menuItem);
     }
 }
Exemple #2
0
        void menuItem_Click(object sender, EventArgs e)
        {
            var menuItem   = (ToolStripMenuItem)sender;
            var filterName = menuItem.Text;

            var allFilters = FilterFramework.FindFilters();
            var filterType = allFilters.Where(f => f.Name == filterName).FirstOrDefault();
            var filter     = (IImageFilter)Activator.CreateInstance(filterType);

            this.pictureBox1.Image = FilterFramework.ApplyFilter(this.pictureBox1.Image, filter);
        }