带轮廓的舱口刷

时间:2019-06-26 11:30:10

标签: c# .net wpf xaml

如何创建每行都带有某种边框的舱口刷?

   <DrawingBrush x:Key="HatchBrush" TileMode="Tile"
          Viewport="0,0,7.5,7.5" ViewportUnits="Absolute"
          Viewbox="0,0,7.5,7.5" ViewboxUnits="Absolute">
        <DrawingBrush.Transform>
            <RotateTransform Angle="45"/>
        </DrawingBrush.Transform>
        <DrawingBrush.Drawing>
            <GeometryDrawing>
                <GeometryDrawing.Pen>
                    <Pen Brush="White" Thickness="4"/>
                </GeometryDrawing.Pen>
                <GeometryDrawing.Geometry>
                    <LineGeometry StartPoint="0,3.75" EndPoint="7.5,3.75"/>
                </GeometryDrawing.Geometry>
            </GeometryDrawing>
        </DrawingBrush.Drawing>
    </DrawingBrush>

目前看起来像这样,并且可以正常使用,但是如您所见,它缺少轮廓。我想在每个白色条纹的外部都留出1-2 px的黑色轮廓,而不管它的长度如何,因此白色永远不会触碰到黑色轮廓。

HatchBrush

0 个答案:

没有答案