This article will briefly introduce the basic graphics in Silverlight, mainly line, Ellipse, Rectangle, Path, Polygon, Polyline Six, and the inheritance relationship between them is as follows:
In Silverlight, all graphics have almost as many important attributes as the following:
Stroke: Padding on border lines
StrokeThickness: Width of border line
Fill: Fills a graphic
Line
Lines, as the name suggests, draw a line between two points, specifying the coordinates of the starting point (X1, Y1) and the endpoint (X2, Y2). As in the following example:
<Canvas Background="#CDFCAE">
<Line Canvas.Top="20" Canvas.Left="20"
X1="20" Y1="20" X2="400" Y2="20"
Stroke="#FF9900" StrokeThickness="4">
</Line>
<Line Canvas.Top="40" Canvas.Left="20"
X1="20" Y1="40" X2="200" Y2="180"
Stroke="#0099FF" StrokeThickness="5">
</Line>
<Line Canvas.Top="20" Canvas.Left="240"
X1="220" Y1="20" X2="220" Y2="200"
StrokeThickness="6">
<Line.Stroke>
<LinearGradientBrush StartPoint="0,0">
<GradientStop Color="#FFFFFF" Offset="0.0" />
<GradientStop Color="#307801" Offset="1.0" />
</LinearGradientBrush>
</Line.Stroke>
</Line>
</Canvas>