Esempio n. 1
0
        public Paint()
        {
            InitializeComponent();
            displayManager = DisplayManager.getInstance(pictureDrawing);
            numberAddTools = -1;
            nameWorkFile   = "";
            isMouseClick   = false;
            prevKey        = new Keys();
            currKey        = new Keys();
            isCtrlZ        = false;
            string currentDir = Path.GetDirectoryName(
                Assembly.GetEntryAssembly().Location);

            string[] addinAssemblies = Directory.GetFiles(currentDir, "*.dll");

            foreach (string file in addinAssemblies)
            {
                Assembly addinAssembly = Assembly.LoadFrom(file);
                foreach (Type t in addinAssembly.GetExportedTypes())
                {
                    if ((t).IsSubclassOf(typeof(Shape)) && t.IsClass && !t.IsAbstract && (typeof(ISelectable).IsAssignableFrom(t) || !typeof(ISelectable).IsAssignableFrom(t)))
                    {
                        addinTypes.Add(t);
                        ToolsFromPlugins.Add(new PictureBox());
                        ToolsFromPlugins[ToolsFromPlugins.Count - 1].Name        = "bpNewTools/" + addinTypes.IndexOf(t);
                        ToolsFromPlugins[ToolsFromPlugins.Count - 1].Parent      = panelTools;
                        ToolsFromPlugins[ToolsFromPlugins.Count - 1].BackColor   = Color.Transparent;
                        ToolsFromPlugins[ToolsFromPlugins.Count - 1].BorderStyle = BorderStyle.FixedSingle;
                        ToolsFromPlugins[ToolsFromPlugins.Count - 1].Location    = (ToolsFromPlugins.Count == 1) ?
                                                                                   new Point(toolFrame.Location.X,
                                                                                             toolFrame.Location.Y + toolFrame.Height + 5) :
                                                                                   new Point(ToolsFromPlugins[ToolsFromPlugins.Count - 2].Location.X,
                                                                                             ToolsFromPlugins[ToolsFromPlugins.Count - 2].Location.Y +
                                                                                             ToolsFromPlugins[ToolsFromPlugins.Count - 2].Height + 5);
                        ToolsFromPlugins[ToolsFromPlugins.Count - 1].Size       = new Size(25, 25);
                        ToolsFromPlugins[ToolsFromPlugins.Count - 1].MouseDown += new MouseEventHandler(ToolsFromPlugins_MouseDown);
                    }
                }
            }
        }
Esempio n. 2
0
 public abstract void workWithFile(List <Shape> shapesList, ref DisplayManager displayManager, ref string nameWorkFile,
                                   List <System.Type> addInType);