mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-08 07:56:07 +02:00
* Reset branch for WPF changes * Convert BMP to PNG; fix link-out-of-scope err * Add snippets for WPF... 6794 files!!!! * Add missing snippets * update file updated between migration * Fix paths to include * update breadcrumb and toc * fix index links * fix index links * fix index links * fix markdown
36 lines
1.9 KiB
Markdown
36 lines
1.9 KiB
Markdown
---
|
|
title: "How to: Create a Quadratic Bezier Curve"
|
|
ms.date: "03/30/2017"
|
|
helpviewer_keywords:
|
|
- "Bezier curves [WPF], creating"
|
|
- "quadratic Bezier curves [WPF], creating"
|
|
- "graphics [WPF], quadratic Bezier curves"
|
|
ms.assetid: cd8fca4a-504e-4fd8-92ea-2969065a6e02
|
|
---
|
|
# How to: Create a Quadratic Bezier Curve
|
|
This example shows how to create a quadratic Bezier curve. To create a quadratic Bezier curve, use the <xref:System.Windows.Media.PathGeometry>, <xref:System.Windows.Media.PathFigure>, and <xref:System.Windows.Media.QuadraticBezierSegment> classes.
|
|
|
|
## Example
|
|
In the following examples, a quadratic Bezier curve is drawn from (10,100) to (300,100). The curve has a control point of (200,200).
|
|
|
|
[xaml]
|
|
|
|
In [!INCLUDE[TLA#tla_xaml](../../../includes/tlasharptla-xaml-md.md)], you can use attribute syntax to describe a path.
|
|
|
|
[!code-xaml[GeometrySample#54](~/samples/snippets/csharp/VS_Snippets_Wpf/GeometrySample/CS/geometryattributesyntaxexample.xaml#54)]
|
|
|
|
[xaml]
|
|
|
|
(Note that this attribute syntax actually creates a <xref:System.Windows.Media.StreamGeometry>, a lighter-weight version of a <xref:System.Windows.Media.PathGeometry>. For more information, see the [Path Markup Syntax](path-markup-syntax.md) page.)
|
|
|
|
In [!INCLUDE[TLA2#tla_xaml](../../../includes/tla2sharptla-xaml-md.md)], you may also draw a quadratic Bezier curve using object element syntax. The following is equivalent to the previous [!INCLUDE[TLA2#tla_xaml](../../../includes/tla2sharptla-xaml-md.md)] example.
|
|
|
|
[!code-xaml[GeometrySample#34](~/samples/snippets/csharp/VS_Snippets_Wpf/GeometrySample/CS/pathgeometryexample.xaml#34)]
|
|
|
|
This example is part of larger sample; for the complete sample, see the [Geometries Sample](https://github.com/Microsoft/WPF-Samples/tree/master/Graphics/Geometry).
|
|
|
|
## See also
|
|
|
|
- [Create an Elliptical Arc](how-to-create-an-elliptical-arc.md)
|
|
- [Create a Cubic Bezier Curve](how-to-create-a-cubic-bezier-curve.md)
|