这是我的画笔:
<DrawingBrush x:Key="GridBrush" TileMode="Tile"
Viewport="0,0,60,30" ViewportUnits="Absolute"
Viewbox="0,0,60,30" ViewboxUnits="Absolute">
<DrawingBrush.Drawing>
<GeometryDrawing>
<GeometryDrawing.Geometry>
<GeometryGroup>
<LineGeometry EndPoint="0,30"/>
<LineGeometry EndPoint="60,0"/>
</GeometryGroup>
</GeometryDrawing.Geometry>
<GeometryDrawing.Pen>
<Pen Brush="DarkGray" Thickness="1" DashCap="Flat" >
<Pen.DashStyle>
<DashStyle Dashes="2,2"/>
</Pen.DashStyle>
</Pen>
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingBrush.Drawing>
</DrawingBrush>
这是我使用它的地方:
<Border Width="721" Background="{StaticResource GridBrush}" UseLayoutRounding="True" SnapsToDevicePixels="True" >
效果是:
基本上中间线是&#34; okish&#34;其他两个比他们应该更宽。我尝试使用UseLayoutRounding,SnapsToDevicePixels,但有或没有这些选项没有任何变化。我现在用完了想法:/