コード例 #1
0
        private void importleftrightToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Filter = "Images|*.JPG;*.JPEG;*.BMP;*.GIF;*.TIF";

                string[] s = lblLeftRightImgs.Text.Split('|');

                //Left
                ofd.Title = s[0];
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    string leftImg = ofd.FileName;

                    System.IO.FileInfo fi = new System.IO.FileInfo(leftImg);
                    if (fi.Name.Split('.')[0].ToUpper().EndsWith("L"))
                    {
                        ofd.FileName = fi.Name.Substring(0, fi.Name.Length - 5) + "R" + fi.Extension;
                    }

                    //Right
                    ofd.Title = s[1];
                    if (ofd.ShowDialog() == DialogResult.OK)
                    {
                        lblStatus.Text = lblOpenFiles.Text;

                        string rightimg = ofd.FileName;

                        Bitmap left  = new Bitmap(leftImg);
                        Bitmap right = new Bitmap(rightimg);

                        frmPicture frmPic = new frmPicture(MPOReader.AssembleJPS(left, right), fi.Directory.GetFiles("*" + fi.Extension), fi.FullName);
                        frmPic.Text      = leftImg;
                        frmPic.MdiParent = this;
                        frmPic.Show();

                        lblStatus.Text = lblReady.Text;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter      = "Stereoscopic Images|*.JPS;*.JPG;*.MPO";
            ofd.Multiselect = true;

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                lblStatus.Text = lblOpenFiles.Text;


                for (int i = 0; i < ofd.FileNames.Length; i++)
                {
                    try
                    {
                        System.IO.FileInfo fi = new System.IO.FileInfo(ofd.FileNames[i]);

                        Bitmap bmp = null;
                        if (fi.Extension.ToLower() == ".mpo")
                        {
                            List <Bitmap> bmps = MPOReader.ReadFromMPF(ofd.FileNames[i]);
                            bmp = MPOReader.AssembleJPS(bmps[0], bmps[1]);
                        }
                        else
                        {
                            bmp = new Bitmap(ofd.FileNames[i]);
                        }
                        frmPicture frmPic = new frmPicture(bmp, fi.Directory.GetFiles("*" + fi.Extension), fi.FullName);
                        frmPic.Text      = ofd.FileNames[i];
                        frmPic.MdiParent = this;
                        frmPic.Show();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString(), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }

                lblStatus.Text = lblReady.Text;
            }
        }