1234567891011121314151617181920212223242526272829303132333435 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace WindowsFormsGDIDrawPolygon
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- Graphics ghs = this.CreateGraphics();
- Pen myPen = new Pen(Color.Black, 3);
- Point point1 = new Point(80, 20);
- Point point2 = new Point(40, 50);
- Point point3 = new Point(80, 80);
- Point point4 = new Point(160, 80);
- Point point5 = new Point(200, 50);
- Point point6 = new Point(160, 20);
- Point[] myPoints = { point1, point2, point3, point4, point5, point6 };
-
- ghs.DrawPolygon(myPen, myPoints);
- }
- }
- }
|