コード例 #1
0
ファイル: Form1.cs プロジェクト: 3dsoft/MakeNCFile
        // Load
        private void loadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                using (FileStream fs = new FileStream(openFileDialog1.FileName, FileMode.Open, FileAccess.Read))
                {
                    PanelInfo pi = new PanelInfo();
                    pi.init();

                    PanelInfo pi2 = new PanelInfo();
                    pi2.init();

                    BinaryFormatter bf = new BinaryFormatter();
                    pi = (PanelInfo)bf.Deserialize(fs);
                    fs.Seek(0, SeekOrigin.Begin);
                    pi2.matrix = new int[pi.pnSize.Width, pi.pnSize.Height];
                    pi2        = (PanelInfo)bf.Deserialize(fs);

                    pi2.pnFileName = openFileDialog1.FileName;

                    FrmGridMain mm = new FrmGridMain();
                    mm.pi        = pi2;
                    mm.MdiParent = this;
                    mm.Show();
                }
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: 3dsoft/MakeNCFile
        // Menu - New Grid
        private void newGridToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmCreateGrid cd = new FrmCreateGrid();
            PanelInfo     pi = new PanelInfo();

            pi.init();
            cd.pi = pi;
            if (cd.ShowDialog() == DialogResult.OK)
            {
                FrmGridMain mm = new FrmGridMain();
                mm.pi        = cd.pi;
                mm.MdiParent = this;
                mm.Show();
            }
        }