Files
docs-desktop/dotnet-desktop-guide/framework/winforms/advanced/how-to-create-figures-from-lines-curves-and-shapes.md
T
Andy De George c0ba284473 Initial winforms content migrated (#18)
* 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
2020-09-01 16:26:21 -07:00

2.2 KiB
Raw Blame History

title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title ms.date dev_langs helpviewer_keywords ms.assetid
How to: Create Figures from Lines, Curves, and Shapes 03/30/2017
csharp
vb
figures [Windows Forms], creating from shapes
figures [Windows Forms], creating from lines
82fd56c7-b443-4765-9b7c-62ce030656ec

How to: Create Figures from Lines, Curves, and Shapes

To create a figure, construct a xref:System.Drawing.Drawing2D.GraphicsPath, and then call methods, such as xref:System.Drawing.Drawing2D.GraphicsPath.AddLine%2A and xref:System.Drawing.Drawing2D.GraphicsPath.AddCurve%2A, to add primitives to the path.

Example

The following code examples create paths that have figures:

  • The first example creates a path that has a single figure. The figure consists of a single arc. The arc has a sweep angle of 180 degrees, which is counterclockwise in the default coordinate system.

  • The second example creates a path that has two figures. The first figure is an arc followed by a line. The second figure is a line followed by a curve followed by a line. The first figure is left open, and the second figure is closed.

[!code-csharpSystem.Drawing.ConstructingDrawingPaths#21] [!code-vbSystem.Drawing.ConstructingDrawingPaths#21]

[!code-csharpSystem.Drawing.ConstructingDrawingPaths#22] [!code-vbSystem.Drawing.ConstructingDrawingPaths#22]

Compiling the Code

The previous examples are designed for use with Windows Forms, and they require xref:System.Windows.Forms.PaintEventArgs e, which is a parameter of the xref:System.Windows.Forms.Control.Paint event handler.

See also