示例#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);
            }
        }
示例#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);
        }
示例#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);
            }
        }
示例#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;
        }
示例#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);
            }
        }
示例#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);
                }
            }
        }
示例#7
0
文件: MainForm.cs 项目: jdilt/iplab
        // 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 );
            }
        }