将行设置为DashStyles.Dot时没有显示任何内容

时间:2009-10-15 14:29:48

标签: wpf drawing pen


<DockPanel LastChildFill="True" Height="18">
<Image Height="18" Width="80">
    <Image.Source>
        <DrawingImage>
            <DrawingImage.Drawing>
                <GeometryDrawing Brush="Black">
                    <GeometryDrawing.Geometry>
                        <LineGeometry StartPoint="0,9" EndPoint="38,9" />
                    </GeometryDrawing.Geometry>
                    <GeometryDrawing.Pen>
                        <Pen DashCap="Flat"
                             Brush="Black"
                             Thickness="0.5"
                             DashStyle="{x:Static DashStyles.Dot}, Mode=OneTime}"
                         />
                    </GeometryDrawing.Pen>
                </GeometryDrawing>
            </DrawingImage.Drawing>
        </DrawingImage>
    </Image.Source>
</Image>
<TextBlock Height="18" Text="{Binding Name, Mode=OneTime}" Margin="3,2,5,0" />
</DockPanel>

1 个答案:

答案 0 :(得分:1)

删除DashCap =“Flat”,您将看到圆点。还有其他DashCaps可以工作:圆形,方形,三角形。