C#各种画图方法小结
本文导语: 1,//描绘曲线 代码示例: //创建曲线中的点 Point point1 = new Point(68, 420); Point point2 = new Point(71, 410); Point point3 = new Point(74, 423); Point point4 = new Point(77, 412); Point point5 = new Point(80, 400); Point point6 = new ...
1,//描绘曲线
//创建曲线中的点
Point point1 = new Point(68, 420);
Point point2 = new Point(71, 410);
Point point3 = new Point(74, 423);
Point point4 = new Point(77, 412);
Point point5 = new Point(80, 400);
Point point6 = new Point(90, 380);
Point point7 = new Point(100, 350);
Point point8 = new Point(120, 320);
Point[] curvePoints = { point1, point2, point3, point4, point5, point6, point7, point8 };
GraphicsPath myPath = new GraphicsPath();
//AddCurve(点阵,起点,终点,弯曲程度)
myPath.AddCurve(curvePoints, 0, 7, 0.8f);
Pen myPen = new Pen(Color.Red, 1);
IMG.DrawPath(myPen, myPath);
2,c#.net画曲线图(坐标)
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;
//数据/月份
public ArrayList arrData=new ArrayList();
public ArrayList arrMonth=new ArrayList();
//定义幕布高宽
private int iCanvasWidth=400;
private int iCanvasHeight=300;
//x轴的间距
private int iX=30;
//y轴间距
private int iY=15;
public void InitArray()
{
for(int i=0;i