예제 #1
0
        private void FigureForm_Load(object sender, EventArgs e)
        {
            List <string> samples = SampleShapes.LoadFileNames();

            foreach (var file in samples)
            {
                ToolStripItem shapesItem = new ToolStripMenuItem(file);
                shapesItem.Click += shapes_Click;
                shapesMenuItem.DropDownItems.Add(shapesItem);
            }
        }
예제 #2
0
        private void shapes_Click(object sender, EventArgs e)
        {
            ToolStripItem toolStripItem = (sender as ToolStripItem);
            string        name          = toolStripItem.Text;

            string filePath = SampleShapes.BuildFilePath(name);
            SerializationManager manager   = new SerializationManager();
            List <Triangle>      triangles = manager.Deserialize(filePath);

            shapes.AddRange(triangles);

            picBox.Invalidate();
        }