Example #1
0
        public void RecalcChart(bool noRedraw = false)
        {
            float fsz = (float)Math.Round(fOptions.DefFontSize * fModel.Scale);

            fModel.DrawFont = AppHost.GfxProvider.CreateFont(fOptions.DefFontName, fsz, false);

            Graphics gfx = null;

            if (fRenderer is TreeChartGfxRenderer)
            {
                gfx = CreateGraphics();
                fRenderer.SetTarget(gfx, false);
            }

            try {
                fModel.RecalcChart(noRedraw);
            } finally {
                if (fRenderer is TreeChartGfxRenderer && gfx != null)
                {
                    gfx.Dispose();
                }
            }

            var imageSize = GetImageSize();

            AdjustViewport(imageSize, noRedraw);
        }
Example #2
0
        protected override void OnPaint(PaintEventArgs e)
        {
            Graphics gfx = e.Graphics;

            fRenderer.SetTarget(gfx, false);
            InternalDraw(ChartDrawMode.dmInteractive, BackgroundMode.bmAny);

            // interactive controls
            fTreeControls.Draw(gfx);

            base.OnPaint(e);
        }
Example #3
0
        public IImage GetPrintableImage()
        {
            ExtSize imageSize = GetImageSize();
            var     frameRect = new Rectangle(0, 0, imageSize.Width, imageSize.Height);

            Image image;

            using (var gfx = CreateGraphics()) {
                image = new Metafile(gfx.GetHdc(), frameRect, MetafileFrameUnit.Pixel, EmfType.EmfOnly);
            }

            using (Graphics gfx = Graphics.FromImage(image)) {
                fRenderer.SetTarget(gfx);
                RenderImage(RenderTarget.Printer);
            }

            return(new ImageHandler(image));
        }
Example #4
0
        public IImage GetPrintableImage()
        {
            ExtSize imageSize = GetImageSize();
            var     frameRect = new Rectangle(0, 0, imageSize.Width, imageSize.Height);

            /*Image image;
             * using (var gfx = CreateGraphics()) {
             *  image = new Metafile(gfx.GetHdc(), frameRect, MetafileFrameUnit.Pixel, EmfType.EmfOnly);
             * }
             *
             * using (Graphics gfx = Graphics.FromImage(image)) {
             *  RenderStaticImage(gfx, true);
             * }*/

            var image = new Bitmap(imageSize.Width, imageSize.Height, PixelFormat.Format24bppRgb);

            using (Graphics gfx = new Graphics(image)) {
                fRenderer.SetTarget(gfx);
                RenderImage(RenderTarget.Printer);
            }

            return(new ImageHandler(image));
        }