* Merge winforms framework content to working branch (#14) * Breadcrumb / TOC / Move net5 to net folder (#15) * change path from net5 to net * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Add .net 5 winforms placeholder article (#16) * added some metadata and adjusted net5 placeholder * corrections * corrections * corrections * Test1 * Swapping landing page vs concept * fix links * Fix links * Fix desc
2.2 KiB
title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
| title | ms.date | dev_langs | helpviewer_keywords | ms.assetid | |||||
|---|---|---|---|---|---|---|---|---|---|
| Polygons in GDI+ | 03/30/2017 |
|
|
a72213d2-d69a-4c2b-a75c-be7b20390c13 |
Polygons in GDI+
A polygon is a closed shape with three or more straight sides. For example, a triangle is a polygon with three sides, a rectangle is a polygon with four sides, and a pentagon is a polygon with five sides. The following illustration shows several polygons.
Drawing a Polygon
To draw a polygon, you need a xref:System.Drawing.Graphics object, a xref:System.Drawing.Pen object, and an array of xref:System.Drawing.Point (or xref:System.Drawing.PointF) objects. The xref:System.Drawing.Graphics object provides the xref:System.Drawing.Graphics.DrawPolygon%2A method. The xref:System.Drawing.Pen object stores attributes, such as width and color, of the line used to render the polygon, and the array of xref:System.Drawing.Point objects stores the points to be connected by straight lines. The xref:System.Drawing.Pen object and the array of xref:System.Drawing.Point objects are passed as arguments to the xref:System.Drawing.Graphics.DrawPolygon%2A method. The following example draws a three-sided polygon. Note that there are only three points in myPointArray: (0, 0), (50, 30), and (30, 60). The xref:System.Drawing.Graphics.DrawPolygon%2A method automatically closes the polygon by drawing a line from (30, 60) back to the starting point (0, 0).
[!code-csharpLinesCurvesAndShapes#111] [!code-vbLinesCurvesAndShapes#111]
The following illustration shows the polygon.

