代码之家  ›  专栏  ›  技术社区  ›  Cooper.Wu

将线条设置为DashStyles.dot时不显示任何内容

  •  0
  • Cooper.Wu  · 技术社区  · 17 年前
    
    <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 回复  |  直到 15 年前
        1
  •  1
  •   Drew Marsh    17 年前

    去掉dashcap=“flat”,你就会看到圆点。还有其他的破折号可以使用:圆形,方形,三角形。

    推荐文章