Basic Drawing and Shapes in Windows Presentation Foundation
article covers the new features introduced in Windows Presentation Foundation
for drawing shapes. A Shape is a type of UIElement, and enables you to draw a
shape to the screen. The Content Panels can contain Shape elements as children.
Whenever the properties of these elements got changed, screen reflects those changes
provides number of Shape classes. These are derived from Shape class. Ellipse,
Line, Path, Polygon, Polyline, and Rectangle are few classes derived from Shape
class. The WPF also defines 3DGementric shapes. The user can define any 3D shape
by specifying collection triangular surfaces in 3D space.
class has following properties:
Stroke - StrokeThickness - Fill - Data
Stretch : Specify the behavior of the shapes, when the width and height of Parent
element got changed. The following are values 'Stretch' property : None
- Fill - Uniform - UniformToFill
Transformation : Specify the type and measure for transformation
- Centre, Angle ScaleTransform - Origin, scale factor SkewTransform - Tilting
angle TranslateTransform - Displacement in x and y
example below defines a line and polyline elements with a stretch to fill and
10 deg rotation.