示例#1
0
        private void AutomationRasterImageViewer_PostRender(object sender, ImageViewerRenderEventArgs e)
        {
            var engine = _engine as AnnDrawRenderingEngine;

            if (engine == null || e.SurfaceContext == null)
            {
                return;
            }

            // Render all containers
            if (_getContainersCallback != null)
            {
                // Using multi-containers
                AnnContainerCollection containers = _getContainersCallback();
                foreach (AnnContainer container in containers)
                {
                    RenderContainer(e, engine, container);
                }
            }
            else
            {
                // Using single-containers, just render the active
                RenderContainer(e, engine, _container);
            }
        }
        // Paint the annotations using the rendering engine (with anti-alias support)
        protected override void OnPostImagePaint(PaintEventArgs e)
        {
            if (IsAutomationAttached)
            {
                AnnWinFormsRenderingEngine engine = _engine as AnnWinFormsRenderingEngine;

                try
                {
                    // Set the anti alias mode
                    e.Graphics.SmoothingMode = AntiAlias ? SmoothingMode.AntiAlias : SmoothingMode.None;


                    // Render all containers
                    if (_automationGetContainersCallback != null)
                    {
                        // Using multi-containers
                        AnnContainerCollection containers = _automationGetContainersCallback();
                        foreach (AnnContainer container in containers)
                        {
                            RenderContainer(e, engine, container);
                        }
                    }
                    else
                    {
                        // Using single-containers, just render the active
                        RenderContainer(e, engine, _container);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }

            base.OnPostImagePaint(e);
        }