private void ClearToolStripMenuItem_Click(object sender, EventArgs e) { img.Dispose(); img = new Bitmap(@"Panoramas\Sample.png"); ImgDpiX = Convert.ToInt32(img.HorizontalResolution); ImgDpiY = Convert.ToInt32(img.VerticalResolution); currentX = -(img.Width * PbDpiX / ImgDpiX - PanoramaPictureBox.Width) / 2; currentY = -(img.Height * PbDpiY / ImgDpiY - PanoramaPictureBox.Height) / 2; PanoramaNameLabel.Text = Program.LocaleLabelsMF[0]; PanoramaPictureBox.Invalidate(); }
private void OpenPanoramaToolStripMenuItem_Click(object sender, EventArgs e) { if (PanoramaOpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } Bitmap NewImage = new Bitmap(PanoramaOpenFileDialog.FileName); if (NewImage.Width < StandardPanoramaSize.Width || NewImage.Height < StandardPanoramaSize.Height) { if (Program.ResizeImage) { img = new Bitmap(NewImage, StandardPanoramaSize.Width, StandardPanoramaSize.Height); } else { MessageBox.Show(Program.LocaleMessageBoxes[1], Program.LocaleMessageBoxes[0], MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else { img = NewImage; } ImgDpiX = Convert.ToInt32(img.HorizontalResolution); ImgDpiY = Convert.ToInt32(img.VerticalResolution); currentX = -(img.Width * PbDpiX / ImgDpiX - PanoramaPictureBox.Width) / 2; currentY = -(img.Height * PbDpiY / ImgDpiY - PanoramaPictureBox.Height) / 2; PanoramaNameLabel.Text = PanoramaOpenFileDialog.SafeFileName; PanoramaPictureBox.Invalidate(); }