In WPF, the operation of multimedia elements such as graphics and images is greatly enriched, and this section focuses on basic graphics.
One, basic type of graphics
For basic graphics classes in WPF, which are primarily located in the System.Windows.Shapes namespace, their classes include:
It should be explained that there are similar types in the System.Windows.Media namespace:
For the class name, add "Geometry", a class called a "geometric class", which is used only to describe graphics, not to use any brush (pen) and brush (Brush), which does not have any color at all, does not support interaction, and is used only to build graphics In addition, geometric classes are usually used as the value of the data property of the path class (usually by GeometryGroup to build complex graphics). For example:
1: <window x:class= "Wpf_26.window1"
2:xmlns= "http://schemas.microsoft.com/winfx/2006/xaml/presentation& quot;
3:xmlns:x= "Http://schemas.microsoft.com/winfx/2006/xaml"
4:xmlns:media= "Clr-namespace:system.windows.media;assembly=windowsbase"
5:title= "Window1" height= "width=" >
6: <grid x:name= "Grid" >
7: <Grid.RowDefinitions>
8: <rowdefinition/>
9: <rowdefinition/>
: </Grid.RowDefinitions>
One: <rectangle grid.row= "0" horizontalalignment= "center" verticalalignment= "center"
12:width= "height=" fill= "Red"/>
<path grid.row= "1" horizontalalignment= "center" verticalalignment= "center"
14:fill= "Blue" >
: <Path.Data>
: <RectangleGeometry>
: <RectangleGeometry.Rect>
: <rect width= "height="/>
: </RectangleGeometry.Rect>
</RectangleGeometry>
</Path.Data>
</Path>
: </Grid>
: </Window>