WPF 背景网格图

利用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>

posted @ 2019-04-09 09:54  ARM830  阅读(1757)  评论(0编辑  收藏  举报