Пример #1
0
        //Menu: File -> Save As
        private void SaveAs(Editor ed)
        {
            if (ed == null) return;
            dlgSave.FileName = ed.cur_fname != "" ? System.IO.Path.GetFileName(ed.cur_fname) : "Untitled.shp";

            if (dlgSave.ShowDialog() == DialogResult.OK)
            {
                if (dlgSave.FilterIndex == 2)
                {
                    CurrentPb.Image.Save(dlgSave.FileName);
                }
                else
                {
                    ed.SaveToFile(dlgSave.FileName);
                    ed.cur_fname = dlgSave.FileName;
                }
            }
        }
Пример #2
0
 //сохранить объект @ed
 private void SaveEditor(Editor ed)
 {
     if (ed.cur_fname != "")
     {
         ed.SaveToFile(ed.cur_fname);
     }
     else
     {
         this.SaveAs(ed);
     }
 }
Пример #3
0
        //создает новую вкладку
        private int NewPage()
        {
            TabPage tpNew = new TabPage("Untitled");
            tpNew.AutoScroll = true;

            PictureBox pbNew = new PictureBox();
            pbNew.Width = tcSheets.Width - 8;
            pbNew.Height = tcSheets.Height - 26;
            pbNew.BorderStyle = BorderStyle.FixedSingle;
            pbNew.MouseDown += Canvas_MouseDown;
            pbNew.MouseUp += Canvas_MouseUp;
            pbNew.MouseMove += Canvas_MouseMove;

            Editor edNew = new Editor(pbNew.Width, pbNew.Height, ref pbNew, (int)tpNew.Handle);
            edNew.onException += ShowErr;
            edNew.onRefresh += AfterDraw;
            edNew.onFileNameChanged += RefCaption;
            edNew.onShapesChanged += RefShapes;

            tpNew.Tag = edNew;
            tpNew.Controls.Add(pbNew);
            tcSheets.TabPages.Add(tpNew);

            return tcSheets.TabCount-1;
        }