示例#1
0
        private void InitAnnotations()
        {
            _annAutomationManager = new AnnAutomationManager();

            // Disable the rotation
            _annAutomationManager.RotateModifierKey   = AnnKeys.None;
            _annAutomationManager.EditObjectAfterDraw = false;

            _annAutomationManager.CreateDefaultObjects();

            _annAutomation = new AnnAutomation(_annAutomationManager, _rasterImageViewer);
            _annAutomation.AfterObjectChanged      += new EventHandler <AnnAfterObjectChangedEventArgs>(_annAutomation_AfterObjectChanged);
            _annAutomation.Container.ObjectAdded   += new EventHandler <AnnObjectCollectionEventArgs>(_annAutomationObjects_ItemAdded);
            _annAutomation.Container.ObjectRemoved += new EventHandler <AnnObjectCollectionEventArgs>(_annAutomationObjects_ItemRemoved);
            _annAutomation.OnShowContextMenu       += new EventHandler <AnnAutomationEventArgs>(_annAutomation_OnShowContextMenu);
            _annAutomation.Draw          += new EventHandler <AnnDrawDesignerEventArgs>(_annAutomation_Draw);
            _annAutomation.SetCursor     += new EventHandler <AnnCursorEventArgs>(_annAutomation_SetCursor);
            _annAutomation.RestoreCursor += new EventHandler(_annAutomation_RestoreCursor);
            // We are not going to do undo/redeo
            _annAutomation.UndoCapacity = 0;
            // Set this as the one and only active automation object so mouse and keyboard events
            // get to it
            _annAutomation.Active = true;
            _annAutomation.DefaultCurrentObjectId = AnnObject.None;


            // Get the rectangle and select objects
            AnnAutomationObject selectAutomationObject = GetAutomationObject(_annAutomationManager, AnnObject.SelectObjectId);

            AnnAutomationObject zoneAutomationObject = CreateZoneAutomationObject();

            _automationManagerHelper = new AutomationManagerHelper(_annAutomationManager);

            ZoneAnnotationObjectRenderer zoneObjectRenderer         = new ZoneAnnotationObjectRenderer();
            IAnnObjectRenderer           annRectangleObjectRenderer = _annAutomationManager.RenderingEngine.Renderers[AnnObject.RectangleObjectId];

            zoneObjectRenderer.LocationsThumbStyle     = annRectangleObjectRenderer.LocationsThumbStyle;
            zoneObjectRenderer.RotateCenterThumbStyle  = annRectangleObjectRenderer.RotateCenterThumbStyle;
            zoneObjectRenderer.RotateGripperThumbStyle = annRectangleObjectRenderer.RotateGripperThumbStyle;

            _annAutomationManager.Objects.Clear();

            ContextMenu cm = new ContextMenu();

            cm.MenuItems.Add(new MenuItem("&Delete", _zoneDeleteMenuItem_Click));
            cm.MenuItems.Add(new MenuItem("-", null as EventHandler));
            cm.MenuItems.Add(new MenuItem("&Properties...", _zonePropertiesMenuItem_Click));

            zoneAutomationObject.ContextMenu = cm;

            _annAutomationManager.RenderingEngine.Renderers[AnnObject.UserObjectId] = zoneObjectRenderer;

            _annAutomationManager.Objects.Add(selectAutomationObject);
            _annAutomationManager.Objects.Add(zoneAutomationObject);

            // Disable Annotation selection object since we don't want users to group annotation objects.
            var selectionObject = _annAutomationManager.FindObjectById(AnnObject.SelectObjectId);

            selectionObject.DrawDesignerType = null;
        }
示例#2
0
        private void InitAutomationManager()
        {
            _annManager = new AnnAutomationManager();

            _annManager.CreateDefaultObjects();
            List <AnnAutomationObject> objectsToRemove = new List <AnnAutomationObject>();

            foreach (AnnAutomationObject obj in _annManager.Objects)
            {
                if (Enum.GetName(typeof(AnnObjects), obj.Id) == null)
                {
                    objectsToRemove.Add(obj);
                }
            }

            foreach (AnnAutomationObject obj in objectsToRemove)
            {
                _annManager.Objects.Remove(obj);
            }
            _automationHelper = new AutomationManagerHelper(_annManager);
            _automationHelper.CreateToolBar();
            if (_annManager.RenderingEngine != null)
            {
                _annManager.RenderingEngine.LoadPicture += RenderingEngine_LoadPicture;
            }

            _automationHelper.ToolBar.Dock       = DockStyle.Right;
            _automationHelper.ToolBar.Appearance = ToolBarAppearance.Flat;
            _automationHelper.ToolBar.AutoSize   = false;
            _automationHelper.ToolBar.Visible    = true;
            _automationHelper.ToolBar.BringToFront();

            this.Controls.Add(_automationHelper.ToolBar);

            foreach (AnnAutomationObject obj in _annManager.Objects)
            {
                obj.UseRotateThumbs = true;
                if (obj.ObjectTemplate != null && obj.ObjectTemplate.SupportsStroke)
                {
                    //obj.Object.Pen = new AnnPen(Color.White, new AnnLength(1));
                }
            }

            _automation = new AnnAutomation(_annManager, _viewer);

            _automation.EditText += new EventHandler <AnnEditTextEventArgs>(automation_EditText);

            //Change AnnText to use Pen
            LeadLengthD         annLength  = new LeadLengthD(1);
            AnnAutomationObject annAutText = _automation.Manager.FindObjectById((int)AnnObjects.TextObjectId);

            annAutText.ObjectTemplate.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create("Red"), annLength);
            _automation.Active = true;
        }
示例#3
0
        private void InitAnnotations()
        {
            _annAutomationManager = new AnnAutomationManager
            {
                RestrictDesigners   = true,
                EditObjectAfterDraw = false
            };
            _annAutomationManager.CreateDefaultObjects();

            // Only show the selector and redaction.  Remove the other objects.
            for (var count = 0; count < _annAutomationManager.Objects.Count; count++)
            {
                var id = _annAutomationManager.Objects[count].Id;
                if (id == AnnObject.RedactionObjectId || id == AnnObject.SelectObjectId)
                {
                    continue;
                }
                _annAutomationManager.Objects.RemoveAt(count);
                count--;
            }

            _automationManagerHelper = new AutomationManagerHelper(_annAutomationManager);
            _automationManagerHelper.CreateToolBar();
            panel1.Controls.Add(_automationManagerHelper.ToolBar);

            _automationControl = new ImageViewerAutomationControl {
                ImageViewer = _imageViewer
            };

            _imageViewer.InteractiveModes.BeginUpdate();
            _imageViewer.InteractiveModes.Add(new AutomationInteractiveMode {
                AutomationControl = _automationControl
            });
            _imageViewer.InteractiveModes.EndUpdate();

            _annAutomation = new AnnAutomation(_annAutomationManager, _automationControl)
            {
                Active = true
            };

            _imageViewer.ItemChanged += (s, e) =>
            {
                if (_annAutomation == null)
                {
                    return;
                }
                _annAutomation.Container.Size =
                    _annAutomation.Container.Mapper.SizeToContainerCoordinates(_imageViewer.ImageSize.ToLeadSizeD());
                _imageViewer.Zoom(ControlSizeMode.Fit, 1, LeadPoint.Empty);
                _annAutomationManager.CurrentObjectId = AnnObject.RedactionObjectId;
            };
        }
示例#4
0
        private void SetupAnnotations(RasterImage image)
        {
            // create and setup the automation manager
            annAutomationManager = new AnnAutomationManager();
            _annotationsHelper   = new AutomationManagerHelper(annAutomationManager);
            annAutomationManager.CreateDefaultObjects();
            //Run mode to prevent editing of annotations
            annAutomationManager.UserMode = AnnUserMode.Render;

            masterSheetViewer.Image = image;

            automation        = new AnnAutomation(annAutomationManager, masterSheetViewer);
            automation.Active = true;

            automation.Container.Children.Clear();

            annotationField             = new AnnHiliteObject();
            annotationField.HiliteColor = "Green";
            automation.Container.Children.Add(annotationField);
        }
示例#5
0
        private void SetupAnnotations()
        {
            // create and setup the automation manager
            annAutomationManager = new AnnAutomationManager();
            _annotationsHelper   = new AutomationManagerHelper(annAutomationManager);
            annAutomationManager.CreateDefaultObjects();
            //Run mode to prevent editing of annotations
            annAutomationManager.UserMode = AnnUserMode.Run;

            //Create dummy image to init automation
            RasterImage img = new RasterImage(RasterMemoryFlags.Conventional, 1, 1, 1, RasterByteOrder.Bgr, RasterViewPerspective.TopLeft, null, IntPtr.Zero, 0);

            img.XResolution         = 150;
            img.YResolution         = 150;
            _filledFormViewer.Image = img;

            automation              = new AnnAutomation(annAutomationManager, _filledFormViewer);
            automation.Active       = true;
            _filledFormViewer.Image = null;
        }
示例#6
0
        private void InitAnnotations()
        {
            try
            {
                _annAutomationManager = AnnAutomationManager.Create(new AnnWinFormsRenderingEngine());
                _annotationsHelper    = new AutomationManagerHelper(_annAutomationManager);

                // Disable the rotation
                _annAutomationManager.RotateModifierKey = AnnKeys.None;

                _annAutomationManager.CreateDefaultObjects();

                _annAutomation = new AnnAutomation(_annAutomationManager, _rasterImageViewer);
                _annAutomation.OnShowContextMenu      += new EventHandler <AnnAutomationEventArgs>(_automation_OnShowContextMenu);
                _annAutomation.OnShowObjectProperties += new EventHandler <AnnAutomationEventArgs>(automation_OnShowObjectProperties);
                _annAutomation.Container.Children.CollectionChanged += new EventHandler <AnnNotifyCollectionChangedEventArgs>(Children_CollectionChanged);
                _annAutomation.AfterObjectChanged          += new EventHandler <AnnAfterObjectChangedEventArgs>(automation_AfterObjectChanged);
                _annAutomation.UndoRedoChanged             += new EventHandler(automation_UndoRedoChanged);
                _annAutomation.LockObject                  += _annAutomation_LockObject;
                _annAutomation.UnlockObject                += _annAutomation_UnlockObject;
                _annAutomation.Active                       = true;
                automationInteractiveMode.AutomationControl = _rasterImageViewer;

                // Remove the following automation objects since we will not use them in this
                // demo
                RemoveObject(_annAutomationManager, AnnObject.HotspotObjectId);
                RemoveObject(_annAutomationManager, AnnObject.FreehandHotspotObjectId);
                RemoveObject(_annAutomationManager, AnnObject.ButtonObjectId);
                RemoveObject(_annAutomationManager, AnnObject.AudioObjectId);
                RemoveObject(_annAutomationManager, AnnObject.EncryptObjectId);
                RemoveObject(_annAutomationManager, AnnObject.PointObjectId);
                RemoveObject(_annAutomationManager, AnnObject.RedactionObjectId);
                RemoveObject(_annAutomationManager, AnnObject.TextRollupObjectId);

                // Remove the Flip, reverse, lock, unlock items from the PopUp menus
                // and remove the "Control Points' item form the dfault menu
                CustomizeAutomationMenu();


                // Disable the rotation points
                foreach (AnnAutomationObject autObj in _annAutomationManager.Objects)
                {
                    autObj.UseRotateThumbs = false;
                }

                _annotationsHelper.CreateToolBar();

                ToolBar tb = _annotationsHelper.ToolBar;
                tb.AutoSize = true;
                tb.Dock     = DockStyle.Right;
                this.Controls.Add(tb);
                tb.BringToFront();
                tb.Appearance = ToolBarAppearance.Flat;

                _rasterImageViewer.BringToFront();
            }
            catch (Exception ex)
            {
                Messager.ShowError(this, ex);
            }
        }
示例#7
0
        private void InitAutomation()
        {
            if (_documentViewer.Annotations == null)
            {
                return;
            }

            // Get the automation manager from the document viewer
            var automationManager = _documentViewer.Annotations.AutomationManager;

            automationManager.UserModeChanged += (sender, e) =>
            {
                // Hide show the toolbars
                _rightPanel.Visible = (automationManager.UserMode != AnnUserMode.Render);

                if (automationManager.UserMode == AnnUserMode.Render)
                {
                    // Setup our custom renderer
                    automationManager.RenderingEngine.Renderers = _renderModeRenderers;
                }
                else
                {
                    automationManager.RenderingEngine.Renderers = _originalRenderers;
                }
            };

            // Create the manager helper. This sets the rendering engine
            _automationManagerHelper = new AutomationManagerHelper(automationManager);

            // Save the rendering engine
            _originalRenderers = automationManager.RenderingEngine.Renderers;
            // And create the render mode renderers, make a copy of it
            _renderModeRenderers = new Dictionary <int, IAnnObjectRenderer>();
            foreach (var item in _originalRenderers)
            {
                _renderModeRenderers.Add(item.Key, item.Value);
            }

            // Tell the document viewer that automation manager helper is created
            _documentViewer.Annotations.Initialize();

            // Update our automation objects (set transparency, etc)
            _automationManagerHelper.UpdateAutomationObjects();

            // Craete the toolbar
            _automationManagerHelper.ModifyToolBarParentVisiblity = true;
            _automationManagerHelper.CreateToolBar();
            var toolBar = _automationManagerHelper.ToolBar;

            toolBar.Dock        = DockStyle.Fill;
            toolBar.AutoSize    = true;
            toolBar.BorderStyle = BorderStyle.None;
            toolBar.Appearance  = ToolBarAppearance.Flat;
            _annotationsToolBarPanel.Controls.Add(toolBar);
            toolBar.BringToFront();

            // Create the objects list
            _automationObjectsList = new AutomationObjectsListControl();

            if (_automationObjectsList != null)
            {
                _automationObjectsList.Dock        = DockStyle.Fill;
                _automationObjectsList.BorderStyle = BorderStyle.None;
                _annotationsObjectsPanel.Controls.Add(_automationObjectsList);
                _automationObjectsList.BringToFront();
            }
        }
示例#8
0
        private void Form1_Load(object sender, EventArgs e)
        {
            viewer      = new ImageViewer();
            viewer.Dock = DockStyle.Fill;

            automationControl             = new ImageViewerAutomationControl();
            automationControl.ImageViewer = viewer;

            ScreenCaptureEngine.Startup();
            scEngine.CaptureInformation += new EventHandler <ScreenCaptureInformationEventArgs>(scEngine_CaptureInformation);
            ScreenCaptureOptions captureOptions = scEngine.CaptureOptions;

            captureOptions.Hotkey   = Keys.None;
            scEngine.CaptureOptions = captureOptions;

            // initialize a new RasterCodecs object
            RasterCodecs codecs = new RasterCodecs();

            // load the main image into the viewer
            viewer.Image = codecs.Load(@"C:\Users\Public\Documents\LEADTOOLS Images\OCR1.TIF");
            viewer.Zoom(ControlSizeMode.FitAlways, 1.0, viewer.DefaultZoomOrigin);

            // initialize the interactive mode for the viewer
            AutomationInteractiveMode automationInteractiveMode = new AutomationInteractiveMode();

            automationInteractiveMode.AutomationControl = automationControl;

            // add the interactive mode to the viewer
            viewer.InteractiveModes.BeginUpdate();
            viewer.InteractiveModes.Add(automationInteractiveMode);
            viewer.InteractiveModes.EndUpdate();

            if (viewer.Image != null)
            {
                // create and set up the automation manager
                annAutomationManager = new AnnAutomationManager();
                annAutomationManager.RestrictDesigners   = true;
                annAutomationManager.EditObjectAfterDraw = false;

                // Instruct the manager to create all of the default automation objects.
                annAutomationManager.CreateDefaultObjects();

                AnnObservableCollection <AnnAutomationObject> annObservable = annAutomationManager.Objects;
                foreach (AnnAutomationObject annObject in annObservable)
                {
                    if (annObject.Id != AnnObject.SelectObjectId)
                    {
                        //  annObservable.Remove(annObject);
                        // annAutomationManager.Objects.Remove(annObject);
                    }
                }


                // initialize the manager helper and create the toolbar and add it then the viewer to the controls
                AutomationManagerHelper managerHelper = new AutomationManagerHelper(annAutomationManager);
                managerHelper.CreateToolBar();
                managerHelper.ToolBar.Dock = DockStyle.Right;
                Controls.Add(managerHelper.ToolBar);
                Controls.Add(viewer);


                // set up the automation (it will create the container as well)
                automation              = new AnnAutomation(annAutomationManager, automationControl);
                automation.EditContent += new EventHandler <AnnEditContentEventArgs>(automation_EditContent);
                // set this automation as the active one
                automation.Active = true;

                //set the size of the container to the size of the viewer
                automation.Container.Size = automation.Container.Mapper.SizeToContainerCoordinates(LeadSizeD.Create(viewer.Image.ImageWidth, viewer.Image.ImageHeight));
            }
        }
示例#9
0
        protected override void OnLoad(EventArgs e)
        {
            if (!DesignMode)
            {
                _automationManager             = new AnnAutomationManager();
                _automationManager.GroupsRoles = _groupsRoles;
                _automationManager.RedactionRealizePassword = string.Empty;
                _automationManager.CreateDefaultObjects();
                _managerHelper = new AutomationManagerHelper(_automationManager);

                _managerHelper.CreateToolBar();
                tabControl1.TabPages[1].Controls.Add(_managerHelper.ToolBar);

                _imageViewer          = new AutomationImageViewer();
                _imageViewer.KeyDown += new KeyEventHandler(_imageViewer_KeyDown);
                tabControl1.TabPages[1].Controls.Add(_imageViewer);

                _managerHelper.ToolBar.Dock       = DockStyle.Right;
                _managerHelper.ToolBar.AutoSize   = false;
                _managerHelper.ToolBar.Appearance = ToolBarAppearance.Flat;
                _managerHelper.ToolBar.BringToFront();

                _imageViewer.Dock   = DockStyle.Fill;
                _imageViewer.UseDpi = false;
                _imageViewer.ImageHorizontalAlignment = Leadtools.Controls.ControlAlignment.Center;
                _imageViewer.ImageBorderColor         = Color.Black;
                _imageViewer.ImageBorderThickness     = 1;
                _imageViewer.BringToFront();

                AutomationInteractiveMode automationInteractiveMode = new AutomationInteractiveMode();
                automationInteractiveMode.MouseButtons = MouseButtons.Left | MouseButtons.Right;
                _imageViewer.InteractiveModes.Add(automationInteractiveMode);

                using (RasterCodecs codec = new RasterCodecs())
                {
                    _imageViewer.Image = codec.Load(DemosGlobal.ImagesFolder + @"\ocr1.tif");
                    _imageViewer.Zoom(Leadtools.Controls.ControlSizeMode.FitWidth, 1, LeadPoint.Empty);
                }

                _automation = new AnnAutomation(_automationManager, _imageViewer);

                // Update the container size
                _automation.Container.Size = _automation.Container.Mapper.SizeToContainerCoordinates(LeadSizeD.Create(_imageViewer.Image.ImageWidth, _imageViewer.Image.ImageHeight));

                _automation.EditText               += new EventHandler <AnnEditTextEventArgs>(automation_EditText);
                _automation.OnShowContextMenu      += new EventHandler <AnnAutomationEventArgs>(automation_OnShowContextMenu);
                _automation.OnShowObjectProperties += new EventHandler <AnnAutomationEventArgs>(automation_OnShowObjectProperties);
                _automation.LockObject             += new EventHandler <AnnLockObjectEventArgs>(automation_LockObject);
                _automation.UnlockObject           += new EventHandler <AnnLockObjectEventArgs>(automation_UnlockObject);
                _automation.SetCursor              += new EventHandler <AnnCursorEventArgs>(automation_SetCursor);
                _automation.RestoreCursor          += new EventHandler(automation_RestoreCursor);

                FlipReverseText(_automationManager.RenderingEngine, true);
                _automation.Active = true;

                _chkLstGroups.CheckOnClick = true;
                _chkLstGroups.ItemCheck   += new ItemCheckEventHandler(_chkLstGroups_ItemCheck);
                _chkLstGroups.Enabled      = _lstUsers.Items.Count > 0 && _lstUsers.SelectedIndex >= 0;

                _chkLstRoles.CheckOnClick = true;
                _chkLstRoles.ItemCheck   += new ItemCheckEventHandler(_chkLstRoles_ItemCheck);
                _chkLstRoles.Items.Add(new CheckRoleItem(AnnRoles.View));
                _chkLstRoles.Items.Add(new CheckRoleItem(AnnRoles.ViewAll));
                _chkLstRoles.Items.Add(new CheckRoleItem(AnnRoles.Edit));
                _chkLstRoles.Items.Add(new CheckRoleItem(AnnRoles.EditAll));
                _chkLstRoles.Items.Add(new CheckRoleItem(CustomRoles.RulersOnly));

                _lstGroups.SelectedIndexChanged += new EventHandler(_lstGroups_SelectedIndexChanged);

                _chkLstRoles.Enabled            = _lstGroups.Items.Count > 0 && _lstGroups.SelectedIndex >= 0;
                _lstUsers.SelectedIndexChanged += new EventHandler(_lstUsers_SelectedIndexChanged);
                _groupsRoles.GenerateRole      += new EventHandler <AnnOperationInfoEventArgs>(_groupsRoles_GenerateRole);

                AnnRoles medicalRoles = new AnnRoles();
                medicalRoles.Add(CustomRoles.RulersOnly);
                AddGroup(_groupsRoles, "Medical", medicalRoles);

                AnnRoles documentRoles = new AnnRoles();
                documentRoles.Add(AnnRoles.View);
                documentRoles.Add(AnnRoles.Edit);

                AddGroup(_groupsRoles, "Document", documentRoles);

                AnnRoles adminRoles = new AnnRoles();
                adminRoles.Add(AnnRoles.EditAll);
                AddGroup(_groupsRoles, "Admins", adminRoles);

                AnnRoles guestRoles = new AnnRoles();
                guestRoles.Add(AnnRoles.ViewAll);
                AddGroup(_groupsRoles, "Guests", guestRoles);

                AddUser(_groupsRoles, "Medical", "MedicalUser");
                AddUser(_groupsRoles, "Document", "DocumentUser");
                AddUser(_groupsRoles, "Guests", "Guest");
                AddUser(_groupsRoles, "Admins", "Admin");
                OnResize(EventArgs.Empty);
            }

            base.OnLoad(e);
        }
示例#10
0
        protected override void OnLoad(EventArgs e)
        {
            if (!DesignMode)
            {
                _automationManager = AnnAutomationManager.Create(new AnnWinFormsRenderingEngine());

                _automationManager.RedactionRealizePassword = string.Empty;
                _automationManager.CreateDefaultObjects();

                _managerHelper = new AutomationManagerHelper(_automationManager);
                _managerHelper.CreateToolBar();
                FlipReverseText(_automationManager.RenderingEngine, true);

                _managerHelper.ToolBar.Dock       = DockStyle.Right;
                _managerHelper.ToolBar.AutoSize   = false;
                _managerHelper.ToolBar.Width      = 100;
                _managerHelper.ToolBar.Appearance = ToolBarAppearance.Normal;
                this.Controls.Add(_managerHelper.ToolBar);
                _managerHelper.ToolBar.BringToFront();

                _imageViewer          = new AutomationImageViewer();
                _imageViewer.KeyDown += new KeyEventHandler(_imageViewer_KeyDown);
                _imageViewer.Dock     = DockStyle.Fill;
                this.Controls.Add(_imageViewer);
                _imageViewer.BringToFront();

                AutomationInteractiveMode automationInteractiveMode = new AutomationInteractiveMode();
                automationInteractiveMode.MouseButtons = MouseButtons.Left | MouseButtons.Right;
                _imageViewer.InteractiveModes.Add(automationInteractiveMode);

                _imageViewer.UseDpi = false;

                _imageViewer.Zoom(Leadtools.Controls.ControlSizeMode.FitWidth, 1, LeadPoint.Empty);
                _imageViewer.ImageHorizontalAlignment = Leadtools.Controls.ControlAlignment.Center;
                _imageViewer.ImageBorderColor         = Color.Black;
                _imageViewer.BorderStyle          = BorderStyle.Fixed3D;
                _imageViewer.ImageBorderThickness = 1;

                using (RasterCodecs codec = new RasterCodecs())
                {
                    _imageViewer.Image = codec.Load(DemosGlobal.ImagesFolder + @"\ocr1.tif");
                    _imageViewer.AutomationDataProvider = new RasterImageAutomationDataProvider(_imageViewer.Image);
                }

                _automation = new AnnAutomation(_automationManager, _imageViewer);

                // Update the container size
                _automation.Container.Size = _automation.Container.Mapper.SizeToContainerCoordinates(LeadSizeD.Create(_imageViewer.Image.ImageWidth, _imageViewer.Image.ImageHeight));

                _automation.EditText               += new EventHandler <AnnEditTextEventArgs>(automation_EditText);
                _automation.OnShowContextMenu      += new EventHandler <AnnAutomationEventArgs>(automation_OnShowContextMenu);
                _automation.OnShowObjectProperties += new EventHandler <AnnAutomationEventArgs>(automation_OnShowObjectProperties);
                _automation.LockObject             += new EventHandler <AnnLockObjectEventArgs>(automation_LockObject);
                _automation.UnlockObject           += new EventHandler <AnnLockObjectEventArgs>(automation_UnlockObject);
                _automation.SetCursor              += new EventHandler <AnnCursorEventArgs>(automation_SetCursor);
                _automation.RestoreCursor          += new EventHandler(automation_RestoreCursor);

                _automation.Active = true;

                _tvLayers.BeginUpdate();
                _tvLayers.HideSelection = false;
                AnnLayer            layer    = AnnLayer.Create("Container");
                AnnObjectCollection children = _automation.Container.Children;
                foreach (AnnObject annObject in children)
                {
                    layer.Children.Add(annObject);
                }

                _containerNode     = new LayerNode(layer, null, false);
                _containerNode.Tag = "Container";

                _tvLayers.Nodes.Add(_containerNode);
                _tvLayers.EndUpdate();
                CreateDefaultLayers();
                OnResize(EventArgs.Empty);
            }

            base.OnLoad(e);
        }