zoukankan      html  css  js  c++  java
  • 2010 11 30 DrawCurve GDI绘制曲线

    vDrawCurve()方法

    该法用光滑的曲线把给定的点连接起来,常用形式有

    public void DrawCurve(Pen pen, Point[] points)

    其中,Point结构类型的数组中指明各节点,默认弯曲强度为0.5,注意数组中至少要有4个元素。

    public void DrawCurve(Pen pen, Point[] points, float tension)

    其中tension指定弯曲强度,该值范围为0.0f ~1.0f,超出此范围会产生异常,当弯曲强度为零时,就是直线

    演示:

    private void Form1_Paint(object sender,

                           System.Windows.Forms.PaintEventArgs e)

    {

      Pen redPen   = new Pen(Color.Red, 3);

      Pen greenPen = new Pen(Color.Green, 3);

      Point[] curvePoints =

      {

      new Point( 50,  250),

      new Point(100,  25),

      new Point(200,  250),

      new Point(250,  50),

      new Point(300,  75),

      new Point(350,  200),

      new Point(400,  150)

      };

      e.Graphics.DrawLines(redPen, curvePoints);

      e.Graphics.DrawCurve(greenPen, curvePoints);

    }

  • 相关阅读:
    19-background
    18-超链接导航栏案例
    17-文本属性和字体属性
    16-margin的用法
    15-浮动
    14-块级元素和行内元素
    13-标准文档流
    12-简单认识下margin
    11-border(边框)
    10-padding(内边距)
  • 原文地址:https://www.cnblogs.com/akak123/p/2269708.html
Copyright © 2011-2022 走看看