public AddCurve ( PointF points, float tension ) : void | ||
points | PointF | |
tension | float | |
return | void |
public void AddCurve(PointF [] points, float tension)
{
if (points == null)
throw new ArgumentNullException ("points");
if (points.Length < 2)
throw new ArgumentException ("not enough points for polygon", "points");
var tangents = GeomUtilities.GetCurveTangents (CURVE_MIN_TERMS, points, points.Length, tension, CurveType.Open);
AppendCurve (points, tangents, 0, points.Length-1, CurveType.Open);
}
GraphicsPath::AddCurve ( Point points ) : void | |
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, int offset, int numberOfSegments, float tension ) : void |
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); }