예제 #1
0
        // create metafile using high-res reference hdc (printer-based)
        private Image GetHighResMetafile(C1.Win.C1Chart.C1Chart chart)
        {
            Metafile meta = null;

            // get high-res reference dc
            using (PrintDocument doc = new PrintDocument())
                using (Graphics gref = doc.PrinterSettings.CreateMeasurementGraphics())
                {
                    // create metafile
                    IntPtr hdc = gref.GetHdc();
                    meta = new Metafile(hdc, EmfType.EmfOnly, "test");

                    // draw chart into metafile
                    using (Graphics g = Graphics.FromImage(meta))
                        chart.Draw(g, new Rectangle(Point.Empty, chart.Size));
                    gref.ReleaseHdc(hdc);
                }

            // done
            return(meta);
        }
 private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
 {
     c1Chart1.Draw(e.Graphics, e.MarginBounds);
 }