Assembly: PresentationCore (in presentationcore.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
Freezable Features: Because it inherits from the Freezable class, the LineGeometry class provides several special features: LineGeometry objects can be declared as resources, shared among multiple objects, made read-only to improve performance, cloned, and made thread-safe. For more information about the different features provided by Freezable objects, see the Freezable Objects Overview.
This example shows how to use the LineGeometry class to describe a line. A LineGeometry is defined by its start and end points.
The following example shows how to create and render a LineGeometry. A Path element is used to render the line. Since a line has no area, the Path object's Fill is not specified; instead the Stroke and StrokeThickness properties are used.
<Path Stroke="Black" StrokeThickness="1" > <Path.Data> <LineGeometry StartPoint="10,20" EndPoint="100,130" /> </Path.Data> </Path>
LineGeometry myLineGeometry = new LineGeometry(); myLineGeometry.StartPoint = new Point(10,20); myLineGeometry.EndPoint = new Point(100,130); Path myPath = new Path(); myPath.Stroke = Brushes.Black; myPath.StrokeThickness = 1; myPath.Data = myLineGeometry;
A LineGeometry drawn from (10,20) to (100,130)
Other simple geometry classes include LineGeometry and EllipseGeometry. These geometries, as well as more complex ones, can also be created using a PathGeometry or StreamGeometry. For more information, see the Geometry Overview.
|How to: Create a Composite Shape|| |
This example shows how to create composite shapes using Geometry objects and display them using a Path element. In the following example, a LineGeometry, EllipseGeometry, and a RectangleGeometry are used with a GeometryGroup to create a composite shape. The geometries are then drawn using a Path element.
|How to: Create a Shape by Using a PathGeometry|| |
This example shows how to create a shape using the PathGeometry class. PathGeometry objects are composed of one or more PathFigure objects; each PathFigure represents a different "figure" or shape. Each PathFigure is itself composed of one or more PathSegment objects, each representing a connected portion of the figure or shape. Segment types include LineSegment, ArcSegment, and BezierSegment.
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.