Пример #1
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;
            }
        }
Пример #2
0
        private void LoadBmpFromFile(string fileName)
        {
            this.Text = "";

            System.IO.FileInfo fi = new System.IO.FileInfo(fileName);

            if (fi.Extension.ToLower() == ".mpo")
            {
                List <Bitmap> bmps = MPOReader.ReadFromMPF(fileName);
                ImgBmp = MPOReader.AssembleJPS(bmps[0], bmps[1]);
            }
            else
            {
                ImgBmp = new Bitmap(fileName);
            }

            ImageFiles = fi.Directory.GetFiles("*" + fi.Extension);
            aspect     = (float)ImgBmp.Width / (float)ImgBmp.Height;

            scale   = 1.0;
            paralax = 0;
            tx      = 0; ty = 0; txTemp = 0; tyTemp = 0;

            ReloadBmp();
            saved     = true;
            this.Text = fileName;

            //Locates current ind position
            for (int ii = 0; ii < ImageFiles.Length; ii++)
            {
                if (ImageFiles[ii].FullName == fileName)
                {
                    curImgIndex = ii;
                }
            }
        }