Exemple #1
0
        /// <summary>
        /// Renders the overviewed document.
        /// </summary>
        private void DrawContents(Graphics g)
        {
            document.SetRenderOptions(options);

            // fill the background
            if (options.EnableBackground)
            {
                if (document.BkgrImagePos >= ImageAlign.Document)
                {
                    // presume graphics is already set up
                    Point pt = DocToScreen(g, new PointF(0, 0));
                    g.RenderingOrigin = pt;

                    System.Drawing.Brush fillBrush = Document.BackBrush.CreateGDIBrush(
                        Document.DocExtents, -Document.DocExtents.Left, -Document.DocExtents.Top);
                    g.FillRectangle(fillBrush, Document.DocExtents);
                    fillBrush.Dispose();
                }
                else
                {
                    System.Drawing.SolidBrush back =
                        new System.Drawing.SolidBrush(Document.BackColor);
                    g.FillRectangle(back, document.DocExtents);
                    back.Dispose();
                }
            }

            g.SmoothingMode = smoothMode;

            // Draw background image
            if (document.BackgroundImage != null)
            {
                if (document.BkgrImagePos >= ImageAlign.Document)
                {
                    if (options.EnableBackgroundImage)
                    {
                        DrawPicture(g, document.BackgroundImage, document.DocExtents,
                                    (ImageAlign)(document.BkgrImagePos - ImageAlign.Document));
                    }
                }
            }

            // Pass for single level shadowing
            if (options.EnableShadows &&
                document.ShadowsStyle == ShadowsStyle.OneLevel)
            {
                foreach (ChartObject obj in document.Objects)
                {
                    obj.Draw(g, true);
                }
            }

            // Pass for objects
            foreach (ChartObject obj in document.Objects)
            {
                if (options.EnableBackground &&
                    Document.ShadowsStyle == ShadowsStyle.ZOrder)
                {
                    obj.Draw(g, true);
                }

                obj.Draw(g, false);
            }

            document.ResetRenderOptions();
        }