// Paste image from clipboard private void PasteFromClipboard() { if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Bitmap)) { ImageDoc imgDoc = new ImageDoc((Bitmap)Clipboard.GetDataObject().GetData(DataFormats.Bitmap), (IDocumentsHost)this); imgDoc.Text = "Image " + unNamedNumber.ToString(); imgDoc.Show(dockManager); imgDoc.Focus(); // set events SetupDocumentEvents(imgDoc); } }
// Create new document public bool NewDocument(Bitmap image) { unNamedNumber++; ImageDoc imgDoc = new ImageDoc(image, (IDocumentsHost)this); imgDoc.Text = "Image " + unNamedNumber.ToString(); imgDoc.Show(dockManager); imgDoc.Focus(); // set events SetupDocumentEvents(imgDoc); return(true); }
// Open specified file private void OpenFile(string fileName) { ImageDoc imgDoc = null; try { // create image document imgDoc = new ImageDoc(fileName, (IDocumentsHost)this); imgDoc.Text = Path.GetFileName(fileName); } catch (ApplicationException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (imgDoc != null) { imgDoc.Show(dockManager); imgDoc.Focus( ); // set events SetupDocumentEvents(imgDoc); } }
// Create new document public bool NewDocument(Bitmap image) { unnamedNumber++; ImageDoc imgDoc = new ImageDoc(image, (IDocumentsHost) this); imgDoc.Text = "Image " + unnamedNumber.ToString(); imgDoc.Show(dockManager); imgDoc.Focus(); // set events SetupDocumentEvents(imgDoc); return true; }
// Paste image from clipboard private void PasteFromClipboard() { if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Bitmap)) { ImageDoc imgDoc = new ImageDoc((Bitmap) Clipboard.GetDataObject().GetData(DataFormats.Bitmap), (IDocumentsHost) this); imgDoc.Text = "Image " + unnamedNumber.ToString(); imgDoc.Show(dockManager); imgDoc.Focus(); // set events SetupDocumentEvents(imgDoc); } }
// Open file private void OpenFile() { if (ofd.ShowDialog() == DialogResult.OK) { ImageDoc imgDoc = null; try { // create image document imgDoc = new ImageDoc(ofd.FileName, (IDocumentsHost) this); imgDoc.Text = Path.GetFileName(ofd.FileName); } catch (ApplicationException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (imgDoc != null) { imgDoc.Show(dockManager); Debug.WriteLine(imgDoc); imgDoc.Focus(); // set events SetupDocumentEvents(imgDoc); } } }
// Open specified file private void OpenFile( string fileName ) { ImageDoc imgDoc = null; try { // create image document imgDoc = new ImageDoc( fileName, (IDocumentsHost) this ); imgDoc.Text = Path.GetFileName( fileName ); } catch ( ApplicationException ex ) { MessageBox.Show( ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); } if ( imgDoc != null ) { imgDoc.Show( dockManager ); imgDoc.Focus( ); // set events SetupDocumentEvents( imgDoc ); } }