private void pasteToolStripMenuItem_Click(object sender, EventArgs e) { try { PictureForm new_picture; if (Clipboard.ContainsData(DataFormats.Bitmap) && !Clipboard.ContainsData(DataFormats.Text)) { new_picture = new PictureForm(); new_picture.opened_image = new TypicalImage((Bitmap)Clipboard.GetImage()); } else if (Clipboard.ContainsData(DataFormats.Bitmap) && Clipboard.ContainsData(DataFormats.Text)) { new_picture = new PictureForm(); IDataObject clips = Clipboard.GetDataObject(); new_picture.opened_image = new TypicalImage((Bitmap)clips.GetData(DataFormats.Bitmap), (string)clips.GetData(DataFormats.Text), true); } else { return; } this.open_this_mdi_picture(new_picture); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void openPicFile(string _fileName) { PictureForm new_picture = new PictureForm(); string ext = Path.GetExtension(_fileName); if (ext.ToLower() == ".ppm") { new_picture.opened_image = new TypicalImage(TypicalImage.Type.PPM, _fileName); } else { new_picture.opened_image = new TypicalImage(TypicalImage.Type.Common, _fileName); } this.open_this_mdi_picture(new_picture); }
private void buttonOK_Click(object sender, EventArgs e) { try { PictureForm new_picture = new PictureForm(); result.id = TypicalImage.get_an_id(); result.set_file_name("Image" + result.id + "." + first.get_extension()); new_picture.opened_image = result; Program.mainForm.open_this_mdi_picture(new_picture); new_picture.Activate(); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void open_this_mdi_picture(PictureForm pic_form) { //if(pic_form.opened_image.get_width() > (int)(Program.mainForm.Width / 1.5)) // pic_form.Width = (int)(Program.mainForm.Width / 1.5); //else // pic_form.Width = pic_form.opened_image.get_width() + 30; //if (pic_form.opened_image.get_height() > (int)(Program.mainForm.Height - 200)) // pic_form.Height = (int)(Program.mainForm.Height - 200); //else // pic_form.Height = pic_form.opened_image.get_height() + 50; pic_form.set_new_image(); pic_form.Text = pic_form.opened_image.get_file_name(); images_array.Add(pic_form.opened_image); pic_form.MdiParent = this; pic_form.Show(); }
private void pasteToolStripMenuItem_Click(object sender, EventArgs e) { try { PictureForm new_picture; if (Clipboard.ContainsData(DataFormats.Bitmap) && !Clipboard.ContainsData(DataFormats.Text)) { new_picture = new PictureForm(); new_picture.opened_image = new TypicalImage((Bitmap)Clipboard.GetImage()); } else if (Clipboard.ContainsData(DataFormats.Bitmap) && Clipboard.ContainsData(DataFormats.Text)) { new_picture = new PictureForm(); IDataObject clips = Clipboard.GetDataObject(); new_picture.opened_image = new TypicalImage((Bitmap)clips.GetData(DataFormats.Bitmap), (string)clips.GetData(DataFormats.Text), true); } else return; this.open_this_mdi_picture(new_picture); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void OpenToolStripMenuItem_Click(object sender, EventArgs e) { try { OpenFileDialog open = new OpenFileDialog(); open.Filter = "Image files (*.ppm, *.jpg, *.jpeg, *.jpe, *.jfif, *.png, *.bmp) | *.ppm; *.jpg; *.jpeg; *.jpe; *.jfif; *.png; *.bmp"; if (open.ShowDialog() == DialogResult.OK) { PictureForm new_picture = new PictureForm(); string ext = Path.GetExtension(open.FileName); if (ext.ToLower() == ".ppm") { new_picture.opened_image = new PPMImage(open.FileName); } else { new_picture.opened_image = new CommonImage(open.FileName); } new_picture.Width = new_picture.opened_image.get_width() + 50; new_picture.Height = new_picture.opened_image.get_height() + 50; new_picture.Text = new_picture.opened_image.get_file_name(); new_picture.MdiParent = this; new_picture.Show(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }