Exemplo n.º 1
0
        // 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);
            }
        }
Exemplo n.º 2
0
        // 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);
        }
Exemplo n.º 3
0
        // 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);
            }
        }
Exemplo n.º 4
0
        // 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;
        }
Exemplo n.º 5
0
        // 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);
            }
        }
Exemplo n.º 6
0
        // 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);
                }
            }
        }
Exemplo n.º 7
0
        // 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 );
            }
        }