|
Page 5 of 6
Graphics
WPF is also a full graphics system and you can draw either in XAML or in code almost anything you want.
For example to draw a line:
<Line Stroke="Black" StrokeThickness="10" X1="10" Y1="10" X2="75" Y2="90"/>
An Ellipse is as easy:
<Ellipse Height="100" Width="200" Fill="Yellow" Stroke="Black" Canvas.Left="175" Canvas.Top="50" StrokeThickness="2" />
You can also draw polylines, i.e multiple connected line segments:
<Polyline Points="25,25 0,50 25, 75 50,50 25,25 25,0" Stroke="Blue" StrokeThickness="10" Canvas.Left="75" Canvas.Top="50"> </Polyline>
You can also create smooth curves fitted to a set of points using Bezier curves but this is a little more complicated – see the documentation.
WPF also supports a wide range of sophisticated fills including gradient and bitmap fills. For example to create a linear gradient fill:
<Rectangle Width="200" Height="100"> <Rectangle.Fill> <LinearGradientBrush StartPoint="0,0" EndPoint="1,1"> <GradientStop Color="Yellow" Offset="0" /> <GradientStop Color="Blue" Offset="1" /> </LinearGradientBrush> </Rectangle.Fill> </Rectangle>

WPF is a complete 2D graphics package
<ASIN:0735619573>
<ASIN:1590599497>
|