Drawing
We know that all images inherit from the shape class. Generally, canvas, ellipse, and path are commonly used)
For example, we want to draw a smiling face like this:
You can write the following in XAML:CodeTo complete
Here, the X: Name = "myellipse" setting can be used to modify its attributes. The background code is as follows:
Converts its width to 200 pixels.
We can also draw a line and use XAML to represent
<Line X1 = "50" Y1 = "200" X2 = "200" y2 = "50" stroke = "green" strokethickness = "3"/>
Stroke is the color of the fill line, strokethickness is the width of the line, x1, x2, Y1, Y2, which is the coordinate.
Use background code to write
Line line = new line ();
Line. X1 = 50;
Line. X2 = 200;
Line. Y1 = 200;
Line. y2 = 50;
Line. Stroke = brushes. Black;
Line. strokethickness = 3;
It must be displayed in the container. For example, if this line is in the grid, the grid name is grid1, And the last line is added to the grid.
Grid1.children. Add (line );
:
The same is true for an elliptical image:
In XAML:
<Ellipse Height = "52" margin = "76,0, 77,41 "name =" ellipse1 "stroke =" black "verticalignment =" bottom "strokethickness =" 6 "fill =" red "/>
The background code is similar to an underscore. Here, an ellipse object is created.
You can also draw a rectangle ).