- 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);
- }
- }
- }
C#编程-131:DrawPolygon绘制多边形
最新推荐文章于 2024-07-17 08:00:00 发布