目前知道有兩種方法:畫多邊形、GraphicsPath。但是用畫多邊形的方式畫三角形不太好。老畫不正的,截圖放大就明顯了。
代碼
1 Point point1 = new Point(0, 0);
2 Point point2 = new Point(11, 0);
3 Point point3 = new Point(5, 8);
4 Point[] pntArr = {point1, point2, point3};
5
6 e.Graphics.FillPolygon(Brushes.Red, pntArr);
7
代碼
1 int len = 10;
2 int x = 0;
3 int y = 0;
4 Point[] pntArr = new Point[3];
5 pntArr[0] = new Point(x, y);
6 pntArr[1] = new Point(x - len, y);
7 pntArr[2] = new Point(x - len / 2, (int)(len * Math.Sqrt(3) / 2 + y));
8 &nbs