Ejemplo n.º 1
0
        /// <summary>
        /// Creates a deep copy of the control.
        /// </summary>
        public PlotControl Clone()
        {
            PlotControl dest = new PlotControl();

            dest.CopyFrom(this);
            return(dest);
        }
Ejemplo n.º 2
0
        // TODO Printing resolution
        /// <summary>
        /// This method is called to print an individual page.
        /// </summary>
        protected override void OnPrintPage(System.Drawing.Printing.PrintPageEventArgs e)
        {
            PlotControl printControl = new PlotControl();
            Rectangle   b            = e.MarginBounds;
            Graphics    g            = e.Graphics;

            g.SetClip(b);
            g.TranslateTransform(b.X, b.Y);
            if (useFullPage)
            {
                printControl.Bounds = new Rectangle(0, 0, b.Width, b.Height);
            }
            else
            {
                float s;
                printControl.Bounds = new Rectangle(0, 0, plot.Width, plot.Height);
                if (b.Width * plot.Height < b.Height * plot.Width)
                {
                    s = (float)b.Width / plot.Width;
                }
                else
                {
                    s = (float)b.Height / plot.Height;
                }
                g.ScaleTransform(s, s);
            }
            printControl.Model = model;
            printControl.SetRange(printControl.x0, printControl.x1, printControl.y0, printControl.y1);
            printControl.SynchDraw = true;             // instruct to printControl to draw synchronously, not on a background thread.
            g.SmoothingMode        = SmoothingMode.HighQuality;
            printControl.Draw(g);
            printControl.Dispose();
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Copies from another PlotControl.
 /// </summary>
 /// <param name="plot">The control to copy from.</param>
 public void CopyFrom(PlotControl plot)
 {
     Model       = (PlotModel)model.Clone();
     Plot        = plot.Plot.Clone();
     Plot.Parent = this;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// The default constructor.
 /// </summary>
 public PlotPrintDocument(PlotControl plot)
 {
     this.plot = plot;
 }