编程语言
首页 > 编程语言> > C# 绘制简单三角形

C# 绘制简单三角形

作者:互联网

先来个等边倒三角形练手:

点1 0,0

点2 100,0

点3 cos(60),sin(60)

var p4 = new Point();
p4.X = 0;
p4.Y = 0;

var p5 = new Point();
p5.X = width;
p5.Y = 0;

a = 60; // 角度
var p6 = new Point();
p6.X = (int)(0 + width * (Math.Cos(Math.PI *a/180d)));
p6.Y = (int)(0 + width * (Math.Sin(Math.PI *a/180d)));

points[0] = p4;
points[1] = p5;
points[2] = p6;
points[3] = p4;
         
Graphics g = e.Graphics;
var p = new Pen(Color.Black);
g.DrawLines(p, points);

 

标签:p6,p4,C#,points,var,new,三角形,绘制,Math
来源: https://www.cnblogs.com/z5337/p/16513899.html