Пример #1
0
        /// <summary>
        /// load a new image with its stamp, if it has one
        /// </summary>
        private void _miFileOpen_Click(object sender, System.EventArgs e)
        {
            try
            {
                // load an image with its stamp, if it has stamp
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Filter           = "All Files|*.*";
                ofd.InitialDirectory = _openInitialPath;
                if (ofd.ShowDialog(this) == DialogResult.OK)
                {
                    // clear the previous image and stamp (if applicable)
                    _viewerImage.Image = null;
                    _viewerStamp.Image = null;

                    // load the image
                    _viewerImage.Image = _codecs.Load(ofd.FileName, 0, CodecsLoadByteOrder.BgrOrGray, 1, 1);
                    _openInitialPath   = Path.GetDirectoryName(ofd.FileName);
                    // update the labels
                    _lblImage.Text = ofd.FileName;

                    // load the stamp
                    _viewerStamp.Image = _codecs.ReadStamp(ofd.FileName, 1);

                    // update the labels
                    _lblStamp.Text = string.Format("Stamp - {0}", ofd.FileName);
                }
            }
            catch (Exception ex)
            {
                Messager.ShowError(this, ex);
            }
            finally
            {
                UpdateMyControls();
            }
        }