Point2D() public method

public Point2D ( System.Drawing.CGPoint pt ) : Point
pt System.Drawing.CGPoint
return System.Drawing.Point
示例#1
0
        public void AddLines(Graphics g, ChartStyle cs)
        {
            // Plot lines:
            foreach (DataSeries ds in DataSeriesList)
            {
                if (ds.LineStyle.IsVisible == true)
                {
                    Pen aPen = new Pen(ds.LineStyle.LineColor, ds.LineStyle.Thickness);
                    aPen.DashStyle = ds.LineStyle.Pattern;
                    if (ds.LineStyle.PlotMethod == LineStyle.PlotLinesMethodEnum.Lines)
                    {
                        for (int i = 1; i < ds.PointList.Count; i++)
                        {
                            g.DrawLine(aPen, cs.Point2D((PointF)ds.PointList[i - 1]),
                                       cs.Point2D((PointF)ds.PointList[i]));
                        }
                    }
                    else if (ds.LineStyle.PlotMethod == LineStyle.PlotLinesMethodEnum.Splines)
                    {
                        ArrayList al = new ArrayList();
                        for (int i = 0; i < ds.PointList.Count; i++)
                        {
                            PointF pt = (PointF)ds.PointList[i];
                            if (pt.X >= cs.XLimMin && pt.X <= cs.XLimMax &&
                                pt.Y >= cs.YLimMin && pt.Y <= cs.YLimMax)
                            {
                                al.Add(pt);
                            }
                        }
                        PointF[] pts = new PointF[al.Count];
                        for (int i = 0; i < pts.Length; i++)
                        {
                            pts[i] = cs.Point2D((PointF)(al[i]));
                        }
                        g.DrawCurve(aPen, pts);
                    }
                    aPen.Dispose();
                }
            }

            // Plot Symbols:
            foreach (DataSeries ds in DataSeriesList)
            {
                for (int i = 0; i < ds.PointList.Count; i++)
                {
                    PointF pt = (PointF)ds.PointList[i];
                    if (pt.X >= cs.XLimMin && pt.X <= cs.XLimMax &&
                        pt.Y >= cs.YLimMin && pt.Y <= cs.YLimMax)
                    {
                        ds.SymbolStyle.DrawSymbol(g, cs.Point2D((PointF)ds.PointList[i]));
                    }
                }
            }
        }
        public void AddLines(Graphics g, ChartStyle cs)
        {
            // Plot lines:
            foreach (DataSeries ds in DataSeriesList)
            {
                if (ds.LineStyle.IsVisible == true)
                {
                    Pen aPen = new Pen(ds.LineStyle.LineColor, ds.LineStyle.Thickness);
                    aPen.DashStyle = ds.LineStyle.Pattern;
                    if (ds.LineStyle.PlotMethod == LineStyle.PlotLinesMethodEnum.Lines)
                    {
                        for (int i = 1; i < ds.PointList.Count; i++)
                        {
                            g.DrawLine(aPen, cs.Point2D((PointF)ds.PointList[i - 1]),
                                             cs.Point2D((PointF)ds.PointList[i]));
                        }
                    }
                    else if (ds.LineStyle.PlotMethod == LineStyle.PlotLinesMethodEnum.Splines)
                    {
                        ArrayList al = new ArrayList();
                        for (int i = 0; i < ds.PointList.Count; i++)
                        {
                            PointF pt = (PointF)ds.PointList[i];
                            if (pt.X >= cs.XLimMin && pt.X <= cs.XLimMax &&
                                pt.Y >= cs.YLimMin && pt.Y <= cs.YLimMax)
                            {
                                al.Add(pt);
                            }
                        }
                        PointF[] pts = new PointF[al.Count];
                        for (int i = 0; i < pts.Length; i++)
                        {
                            pts[i] = cs.Point2D((PointF)(al[i]));
                        }
                        g.DrawCurve(aPen, pts);
                    }
                    aPen.Dispose();
                }
            }

            // Plot Symbols:
            foreach (DataSeries ds in DataSeriesList)
            {
                for (int i = 0; i < ds.PointList.Count; i++)
                {
                    PointF pt = (PointF)ds.PointList[i];
                    if (pt.X >= cs.XLimMin && pt.X <= cs.XLimMax &&
                        pt.Y >= cs.YLimMin && pt.Y <= cs.YLimMax)
                    {
                        ds.SymbolStyle.DrawSymbol(g, cs.Point2D((PointF)ds.PointList[i]));
                    }
                }
            }
        }