欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

C#画笔Pen绘制光滑模式曲线的方法

程序员文章站 2022-07-22 19:31:55
本文实例讲述了c#画笔pen绘制光滑模式曲线的方法。分享给大家供大家参考。具体实现方法如下: using system; using system.collec...

本文实例讲述了c#画笔pen绘制光滑模式曲线的方法。分享给大家供大家参考。具体实现方法如下:

using system;
using system.collections.generic;
using system.componentmodel;
using system.data;
using system.drawing;
using system.text;
using system.windows.forms;
using system.drawing.drawing2d;
namespace windowsapplication2
{
  public partial class form11 : form
  {
    public form11()
    {
      initializecomponent();
    }
    private void button1_click(object sender, eventargs e)
    {
      lineargradientbrush brush = new lineargradientbrush(this.clientrectangle, color.empty, color.empty, 100);
      colorblend blend = new colorblend();
      blend.colors = new color[] { color.red, color.green, color.blue };
      blend.positions = new float[] { 0, .5f, 1 };
      brush.interpolationcolors = blend;
      pen pen5 = new pen(brush);
      graphics g5 = this.creategraphics();
      point[] p = new point[] { new point(0, 0), new point(100, 100), new point(50, 100), new point(200, 100) };
      g5.smoothingmode = smoothingmode.antialias;
      g5.drawcurve(pen5,p);
    }
  }
}

希望本文所述对大家的c#程序设计有所帮助。