利用DrawingBrush来画出背景网格图

     <DrawingBrush
Viewport="0,0,80,80" ViewportUnits="Absolute" TileMode="Tile">
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing>
<GeometryDrawing.Brush>
<SolidColorBrush Color="Black"/>
</GeometryDrawing.Brush>
<GeometryDrawing.Geometry>
<RectangleGeometry Rect="0,0,80,80"/>
</GeometryDrawing.Geometry>
<GeometryDrawing.Pen>
<Pen Brush="White"/>
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>

WPF 背景网格图-LMLPHP

05-11 11:19