System.Drawing.Drawing2D.GraphicsPath.AddCurve C# (CSharp) Method

AddCurve() public method

public AddCurve ( Point points ) : void
points Point
return void
        public void AddCurve(Point [] points)
        {
            AddCurve (points.ToFloat(), 0.5f);
        }

Same methods

GraphicsPath::AddCurve ( Point points, float tension ) : void
GraphicsPath::AddCurve ( Point points, int offset, int numberOfSegments, float tension ) : void
GraphicsPath::AddCurve ( PointF points ) : void
GraphicsPath::AddCurve ( PointF points, float tension ) : void
GraphicsPath::AddCurve ( PointF points, int offset, int numberOfSegments, float tension ) : void

Usage Example

Exemplo n.º 1
0
        private void Demo0(Graphics g)
        {
            renderXY(g);//初始化坐标轴

            //========划线-画点
            Pen pen1 = new Pen(Color.Red, 1);
            Pen pen2 = new Pen(Color.Blue);
            int total_point_num=1000;
            PointF[] CurvePoints = new PointF[total_point_num];
            for (int x = 0; x < total_point_num; x += 10)
            {
                //计算点坐标-正弦曲线
                float y = (float)( 100*Math.Sin(x*300) );
                //坐标轴置换
                y = -y + this.pictureBox1.Height-200;
                //点保存到数组中,供下文创建路径用
                CurvePoints[x] = new PointF(x, y);
                //画空心点-画笔,矩形(坐标x,坐标y,宽度,高度);
                g.DrawEllipse(pen2, new RectangleF(x, y, 3, 3));
            }

            //创建路径
            GraphicsPath myPath = new GraphicsPath();
            //AddCurve(点阵,起点,终点,弯曲程度)
            //myPath.AddCurve(CurvePoints, 0, 7, 0.8f);
            myPath.AddCurve(CurvePoints,0,300,0.01F);
            //定义画笔
            Pen myPen = new Pen(Color.Red, 1);
            //划线--------------------------------------------bug为什么点稀疏的时候不是两两连接?
            //g.DrawPath(myPen, myPath);

            //g.DrawCurve(pen1, CurvePoints, 0.05F);
        }
All Usage Examples Of System.Drawing.Drawing2D.GraphicsPath::AddCurve