예제 #1
0
        private void open_Click(object sender, EventArgs e)
        {
            sProjectPath = "";
            OpenFileDialog openFile = new OpenFileDialog();

            openFile.Filter           = "configuration (*.xml)|*.xml";
            openFile.InitialDirectory = "";
            openFile.Title            = "open files";
            openFile.FileName         = "";
            if (openFile.ShowDialog() == DialogResult.OK)
            {
                string projectpath = openFile.FileName;
                string sname       = new FileInfo(projectpath).Name;
                Document = doc1;
                doc1.DrawObjectList.Clear();
                DrawRegion.Top    = 0;
                DrawRegion.Left   = 0;
                DrawRegion.Width  = drawregOrigSize.Width;
                DrawRegion.Height = drawregOrigSize.Height;
                drapIsDown        = false;
                this.Cursor       = System.Windows.Forms.Cursors.Default;
                try
                {
                    FileStream    fs           = new FileStream(projectpath, FileMode.Open);
                    XmlSerializer mySerializer = new XmlSerializer(typeof(DrawDoc));
                    doc1 = (DrawDoc)mySerializer.Deserialize(fs);
                    fs.Close();
                    Document = doc1;
                }
                catch
                {
                    MessageBox.Show("open error");
                }
            }
            DrawRegion.Invalidate();
        }
예제 #2
0
 private void open_Click(object sender, EventArgs e)
 {
     sProjectPath = "";
     OpenFileDialog openFile = new OpenFileDialog();
     openFile.Filter = "configuration (*.xml)|*.xml";
     openFile.InitialDirectory = "";
     openFile.Title = "open files";
     openFile.FileName = "";
     if (openFile.ShowDialog() == DialogResult.OK)
     {
         string projectpath = openFile.FileName;
         string sname = new FileInfo(projectpath).Name;
         Document = doc1;
         doc1.DrawObjectList.Clear();
         DrawRegion.Top = 0;
         DrawRegion.Left = 0;
         DrawRegion.Width = drawregOrigSize.Width;
         DrawRegion.Height = drawregOrigSize.Height;
         drapIsDown = false;
         this.Cursor = System.Windows.Forms.Cursors.Default;
         try
         {
             FileStream fs = new FileStream(projectpath, FileMode.Open);
             XmlSerializer mySerializer = new XmlSerializer(typeof(DrawDoc));
             doc1 = (DrawDoc)mySerializer.Deserialize(fs);
             fs.Close();
             Document = doc1;
         }
         catch
         {
             MessageBox.Show("open error");
         }
     }
     DrawRegion.Invalidate();
 }