Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 1.59 KB

how-to-flatten-a-curved-path-into-a-line.md

File metadata and controls

27 lines (21 loc) · 1.59 KB
title ms.date helpviewer_keywords ms.assetid description
How to: Flatten a Curved Path into a Line
03/30/2017
graphics [Windows Forms], flattening curves into lines
curves [Windows Forms], flattening
GraphicsPath object
paths [Windows Forms], flattening
drawing [Windows Forms], flattening curves
e654b8de-25f4-4735-9208-42e4514a589c
Learn how to flatten a curved path into a line by calling the Flatten method of a GraphicsPath object

How to: Flatten a Curved Path into a Line

A xref:System.Drawing.Drawing2D.GraphicsPath object stores a sequence of lines and Bézier splines. You can add several types of curves (ellipses, arcs, cardinal splines) to a path, but each curve is converted to a Bézier spline before it is stored in the path. Flattening a path consists of converting each Bézier spline in the path to a sequence of straight lines. The following illustration shows a path before and after flattening.

Straight Lines and Curves

To Flatten a Path

  • call the xref:System.Drawing.Drawing2D.GraphicsPath.Flatten%2A method of a xref:System.Drawing.Drawing2D.GraphicsPath object. The xref:System.Drawing.Drawing2D.GraphicsPath.Flatten%2A method receives a flatness argument that specifies the maximum distance between the flattened path and the original path.

See also