
加载中…
个人资料
- 博客访问:
- 关注人气:
- 获赠金笔:0支
- 赠出金笔:0支
- 荣誉徽章:
C#编程-131:DrawPolygon绘制多边形
(2017-08-20 13:19:11)
-
using System;
-
using System.Collections.Generic;
-
using System.ComponentModel;
-
using System.Data;
-
using System.Drawing;
-
using System.Linq;
-
using System.Text;
-
using System.Windows.Forms;
-
-
namespace PolygonTest
-
{
-
public partial class Form1 : Form
-
{
-
public Form1()
-
{
-
InitializeComponent();
-
}
-
-
private void Form1_Paint(object sender, PaintEventArgs e)
-
{
-
Graphics g = e.Graphics;
-
Pen pen = new Pen(Color.Orange,3);
-
//绘制三角形
-
Point[] points={
-
new Point(220,176),
-
new Point(320,76),
-
new Point(220,76)
-
};
-
g.DrawPolygon(pen,points);
-
//绘制五角星
-
Point[] ps ={
-
new Point(0,76),
-
new Point(80,76),
-
new Point(106,0),
-
new Point(130,76),
-
new Point(210,76),
-
new Point(146,124),
-
new Point(170,200),
-
new Point(106,152),
-
new Point(40,200),
-
new Point(66,124),
-
-
};
-
g.DrawPolygon(pen,ps);
-
}
-
}
-
}
喜欢
0
赠金笔
加载中,请稍候......