示例#1
0
        public void save()
        {
            SaveFileDialog save = new SaveFileDialog();

            save.FileName = opened_image.get_file_name();
            save.Filter   = "PPM Image (.ppm)|*.ppm|Bitmap Image (.bmp)|*.bmp|Gif Image (.gif)|*.gif|JPEG Image (.jpeg)|*.jpeg; *.jpg|Png Image (.png)|*.png|Tiff Image (.tiff)|*.tiff; *.tif";
            Hashtable formats = new Hashtable();

            formats.Add("ppm", 1);
            formats.Add("bmp", 2);
            formats.Add("gif", 3);
            formats.Add("jpeg", 4);
            formats.Add("jpg", 4);
            formats.Add("png", 5);
            formats.Add("tiff", 6);
            formats.Add("tif", 6);
            save.FilterIndex   = (int)formats[opened_image.get_extension()];
            save.ValidateNames = true;
            save.AddExtension  = true;
            if (save.ShowDialog() == DialogResult.OK)
            {
                string ext = Path.GetExtension(save.FileName);
                if (ext == ".ppm")
                {
                    SaveForm saveform = new SaveForm();
                    saveform.saving_image = this.opened_image;
                    saveform.fileName     = save.FileName;
                    saveform.ShowDialog(this);
                }
                else if (ext == ".bmp")
                {
                    opened_image.save_common(save.FileName, ImageFormat.Bmp);
                }
                else if (ext == ".gif")
                {
                    opened_image.save_common(save.FileName, ImageFormat.Gif);
                }
                else if (ext == ".jpeg" || ext == ".jpg")
                {
                    opened_image.save_common(save.FileName, ImageFormat.Jpeg);
                }
                else if (ext == ".png")
                {
                    opened_image.save_common(save.FileName, ImageFormat.Png);
                }
                else if (ext == ".tiff" || ext == ".tif")
                {
                    opened_image.save_common(save.FileName, ImageFormat.Tiff);
                }
            }
        }
示例#2
0
        public void save()
        {
            SaveFileDialog save = new SaveFileDialog();
            save.FileName = opened_image.get_file_name();
            save.Filter = "PPM Image (.ppm)|*.ppm|Bitmap Image (.bmp)|*.bmp|Gif Image (.gif)|*.gif|JPEG Image (.jpeg)|*.jpeg; *.jpg|Png Image (.png)|*.png|Tiff Image (.tiff)|*.tiff; *.tif";
            Hashtable formats = new Hashtable();
            formats.Add("ppm", 1);
            formats.Add("bmp", 2);
            formats.Add("gif", 3);
            formats.Add("jpeg", 4);
            formats.Add("jpg", 4);
            formats.Add("png", 5);
            formats.Add("tiff", 6);
            formats.Add("tif", 6);
            save.FilterIndex = (int)formats[opened_image.get_extension()];
            save.ValidateNames = true;
            save.AddExtension = true;
            if (save.ShowDialog() == DialogResult.OK)
            {
                string ext = Path.GetExtension(save.FileName);
                if (ext == ".ppm")
                {
                    SaveForm saveform = new SaveForm();
                    saveform.saving_image = this.opened_image;
                    saveform.fileName = save.FileName;
                    saveform.ShowDialog(this);
                }
                else if(ext == ".bmp")
                {
                    opened_image.save_common(save.FileName, ImageFormat.Bmp);
                }
                else if(ext == ".gif")
                {
                    opened_image.save_common(save.FileName, ImageFormat.Gif);
                }
                else if (ext == ".jpeg" || ext == ".jpg")
                {
                    opened_image.save_common(save.FileName, ImageFormat.Jpeg);
                }
                else if (ext == ".png")
                {
                    opened_image.save_common(save.FileName, ImageFormat.Png);
                }
                else if (ext == ".tiff" || ext == ".tif")
                {
                    opened_image.save_common(save.FileName, ImageFormat.Tiff);
                }

            }
        }
示例#3
0
        private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (opened_image != null)
            {
                SaveForm saveform = new SaveForm();
                saveform.ShowDialog(this);

            }
            else
            {
                MessageBox.Show("No image to save.");
            }
        }