示例#1
0
        private void openFile()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Lines doc file (*.lin)|*.lin";
            openFileDialog.Title  = "Open lines file";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                FileName = openFileDialog.FileName;
                try
                {
                    using (FileStream fileStream = new FileStream(FileName, FileMode.Open))
                    {
                        IFormatter formater = new BinaryFormatter();
                        linesDoc = (LinesDoc)formater.Deserialize(fileStream);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Could not read file: " + FileName);
                    FileName = null;
                    return;
                }
                Invalidate(true);
            }
        }
示例#2
0
 public Form1()
 {
     InitializeComponent();
     currentPoint        = new Point();
     dashedPen           = new Pen(Color.Black, 1);
     dashedPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
     solidPen            = new Pen(Color.Black, 3);
     DoubleBuffered      = true;
     hasPosioner         = true;
     linesDoc            = new LinesDoc();
     width = 3;
 }
示例#3
0
文件: Form1.cs 项目: kicoo7/VP
 public Form1()
 {
     InitializeComponent();
     currentPoint = new Point();
     dashedPen = new Pen(Color.Black, 1);
     dashedPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
     solidPen = new Pen(Color.Black, 3);
     DoubleBuffered = true;
     hasPosioner = true;
     linesDoc = new LinesDoc();
     width = 3;
 }
示例#4
0
 private void newToolStripButton_Click(object sender, EventArgs e)
 {
     linesDoc = new LinesDoc();
     Invalidate(true);
 }
示例#5
0
文件: Form1.cs 项目: kicoo7/VP
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     linesDoc = new LinesDoc();
     Invalidate(true);
 }
示例#6
0
文件: Form1.cs 项目: kicoo7/VP
 private void openFile()
 {
     OpenFileDialog openFileDialog = new OpenFileDialog();
     openFileDialog.Filter = "Lines doc file (*.lin)|*.lin";
     openFileDialog.Title = "Open lines file";
     if (openFileDialog.ShowDialog() == DialogResult.OK)
     {
         FileName = openFileDialog.FileName;
         try
         {
             using (FileStream fileStream = new FileStream(FileName, FileMode.Open))
             {
                 IFormatter formater = new BinaryFormatter();
                 linesDoc = (LinesDoc)formater.Deserialize(fileStream);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Could not read file: " + FileName);
             FileName = null;
             return;
         }
         Invalidate(true);
     }
 }