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

作者:zhuzhao 时间:2021-11-26 05:13:33 

本文实例讲述了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#程序设计有所帮助。

标签:C#,画笔,绘制
0
投稿

猜你喜欢

  • C#获取ListView鼠标下的Item实例

    2023-04-29 11:45:10
  • 深入JAVA对象深度克隆的详解

    2022-01-05 14:03:13
  • Android10填坑适配指南(实际经验代码)

    2022-10-05 19:51:19
  • C#中OpenCVSharp实现轮廓检测

    2022-04-03 17:38:11
  • C#实现加密exe文件

    2023-12-03 13:04:47
  • Android自定义view实现圆形、圆角和椭圆图片(BitmapShader图形渲染)

    2022-10-08 07:51:35
  • Java(TM) Platform SE binary 打开jar文件的操作

    2021-10-02 00:08:12
  • C#中的Linq To XML讲解

    2021-06-29 18:39:43
  • C#实现程序开机启动的方法

    2023-09-23 00:55:20
  • webBrowser执行js的方法,并返回值,c#后台取值的实现

    2023-12-07 13:29:13
  • c#构造ColorComboBox(颜色下拉框)

    2022-07-23 21:54:12
  • C#多线程之Parallel类的用法

    2023-05-15 06:02:03
  • flutter text组件使用示例详解

    2022-07-11 11:08:42
  • java客户端登陆服务器用户名验证

    2023-11-09 07:03:09
  • Java执行SQL脚本文件到数据库详解

    2023-08-08 08:30:00
  • Android横竖屏幕切换小结

    2023-04-15 08:03:20
  • (starters)springboot-starter整合阿里云datahub方式

    2023-03-12 06:28:16
  • Java实现分布式系统限流

    2022-05-31 22:38:05
  • Android ListView的item背景色设置和item点击无响应的解决方法

    2021-07-30 11:26:16
  • 基于Nacos实现Spring Cloud Gateway实现动态路由的方法

    2022-04-14 07:18:56
  • asp之家 软件编程 m.aspxhome.com