Exemplo n.º 1
0
        /// <summary>
        /// Loads the images in view mode.
        /// </summary>
        public void LoadImage()
        {
            try
            {
                ImageLoader imgLoader = new ImageLoader();

                imgLoader.FileName = newFileName;
                imgLoader.Load(_codec);
                RasterImage _image = imgLoader.Image;
                this.imageViewer.Image = null;
                imageFileName          = newFileName;
                if (_image != null)
                {
                    this.imageViewer.Image = _image;
                    ImageSizing sizing = new ImageSizing(imageViewer);
                    sizing.SetScale(scaleFactor);
                    _codec.Options.Load.XResolution             = imageViewer.Image.XResolution;
                    _codec.Options.Load.YResolution             = imageViewer.Image.YResolution;
                    _annAutomation.Container.UnitConverter.DpiX = imageViewer.Image.XResolution;
                    _annAutomation.Container.UnitConverter.DpiY = imageViewer.Image.YResolution;

                    if (imageViewer.Image.XResolution == 204 && imageViewer.Image.YResolution == 196)
                    {
                        imageViewer.UseDpi = true;
                    }
                    else
                    {
                        imageViewer.UseDpi = false;
                    }

                    annotation.LoadFromFile(imageFileName);
                    annotation.LoadFromMemory(1);
                    imageToolBar.setFileName(newFileName);
                }

                _annAutomation.ObjectsDirty = false;
                _annAutomation.ImageDirty   = false;

                imageToolBar.UpdateToolBar();

                saveAsFileName = null; // always user has to set it.
//                this.Edit = false;
            }
            catch (Exception e)
            {
                imageViewer.Image           = null;
                _annAutomation.ObjectsDirty = false;
                _annAutomation.ImageDirty   = false;
                imageToolBar.UpdateToolBar();
                XtraMessageBox.Show("An error occurred while loading the image for file: " + newFileName + "." + Environment.NewLine +
                                    "Error CNF-391 in " + FORM_NAME + ".LoadImage(): " + e.Message,
                                    FORM_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        private void IntializeAnnContainer()
        {
             SuspendLayout();

            imageViewer = new RasterImageViewer();
             imageViewer.Dock = DockStyle.Fill;
             imageViewer.EnableScrollingInterface = true;
             this.imageViewer.KeyDown += new System.Windows.Forms.KeyEventHandler(this.imageViewer_KeyDown);
             this.imageViewer.DoubleClick += new System.EventHandler(this.imageViewer_Clicked);
            // this.imageViewer.MouseMove += new System.Windows.Forms.MouseEventHandler(this._viewer_MouseMove);
             
             this.Controls.Add(imageViewer);

            

            _automationManager = new AnnAutomationManager();
            _annAutomation = new AnnAutomation(_automationManager, this.imageViewer);
            _annAutomation.Active = true;
            this.imageViewer.BringToFront();
            
            //imageViewer.
            
           
      
            _codec = new RasterCodecs();
            CodecsTxtLoadOptions txtOption = _codec.Options.Txt.Load;
            txtOption.Enabled = true;

            _automationManager.RasterCodecs = _codec;
            _automationManager.RedactionRealizePassword = "";
            _automationManager.CreateDefaultObjects();
            CustomizeObjectProperty();

             
            PropertyForm propForm = new PropertyForm();
            
            _automationManager.ObjectPropertiesDialogType = propForm.GetType();
         //   _automationManager.ObjectPropertiesDialogType = null;
            AddCheckMark(_automationManager);

            _automationManager.CreateToolBar();
            _automationManager.ToolBar.BringToFront();
            imageToolBar = new ImageToolBar();
            this.imageToolBar.TifEditor = this;
            toolBar = imageToolBar.GetExtendedToolBar(_automationManager.ToolBar);
            toolBar.Dock = DockStyle.Bottom;

            this.Controls.Add(_automationManager.ToolBar);




            topToolBar = imageToolBar.AddCustomToolBar(topToolBar);

            
            imageToolBar.UpdateToolBar();
            ResumeLayout();

            RasterPaintProperties prop = imageViewer.PaintProperties;
           // prop.PaintDisplayMode |= RasterPaintDisplayModeFlags.ScaleToGray | RasterPaintDisplayModeFlags.Bicubic;
            prop.PaintDisplayMode = RasterPaintDisplayModeFlags.ScaleToGray;
            imageViewer.PaintProperties = prop;
            

            
            InitialzeEdit();


        }
Exemplo n.º 3
0
        private void IntializeAnnContainer()
        {
            SuspendLayout();

            imageViewer      = new RasterImageViewer();
            imageViewer.Dock = DockStyle.Fill;
            imageViewer.EnableScrollingInterface = true;
            this.imageViewer.KeyDown            += new System.Windows.Forms.KeyEventHandler(this.imageViewer_KeyDown);
            this.imageViewer.DoubleClick        += new System.EventHandler(this.imageViewer_Clicked);
            // this.imageViewer.MouseMove += new System.Windows.Forms.MouseEventHandler(this._viewer_MouseMove);

            this.Controls.Add(imageViewer);



            _automationManager    = new AnnAutomationManager();
            _annAutomation        = new AnnAutomation(_automationManager, this.imageViewer);
            _annAutomation.Active = true;
            this.imageViewer.BringToFront();

            //imageViewer.



            _codec = new RasterCodecs();
            CodecsTxtLoadOptions txtOption = _codec.Options.Txt.Load;

            txtOption.Enabled = true;

            _automationManager.RasterCodecs             = _codec;
            _automationManager.RedactionRealizePassword = "";
            _automationManager.CreateDefaultObjects();
            CustomizeObjectProperty();


            PropertyForm propForm = new PropertyForm();

            _automationManager.ObjectPropertiesDialogType = propForm.GetType();
            //   _automationManager.ObjectPropertiesDialogType = null;
            AddCheckMark(_automationManager);

            _automationManager.CreateToolBar();
            _automationManager.ToolBar.BringToFront();
            imageToolBar = new ImageToolBar();
            this.imageToolBar.TifEditor = this;
            toolBar      = imageToolBar.GetExtendedToolBar(_automationManager.ToolBar);
            toolBar.Dock = DockStyle.Bottom;

            this.Controls.Add(_automationManager.ToolBar);



            topToolBar = imageToolBar.AddCustomToolBar(topToolBar);


            imageToolBar.UpdateToolBar();
            ResumeLayout();

            RasterPaintProperties prop = imageViewer.PaintProperties;

            // prop.PaintDisplayMode |= RasterPaintDisplayModeFlags.ScaleToGray | RasterPaintDisplayModeFlags.Bicubic;
            prop.PaintDisplayMode       = RasterPaintDisplayModeFlags.ScaleToGray;
            imageViewer.PaintProperties = prop;



            InitialzeEdit();
        }