代码之家  ›  专栏  ›  技术社区  ›  t9mike

调整文本块中的上划线填充<span>

  •  4
  • t9mike  · 技术社区  · 13 年前

    我正在使用 <Span TextDecorations="Overline" BaselineAlignment="Bottom"> 在文本块中:

    <TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" 
               TextWrapping="Wrap" Width="276">
        Hello world. This is some text. This is an 
        <Span TextDecorations="Overline" BaselineAlignment="Bottom">
            OVERLINE
        </Span>
    </TextBlock>
    

    生产:

    Screen Shot

    有没有办法减少字符顶部和上划线之间的间距?例如,我更喜欢:

    enter image description here

    我知道,非常微妙的转变。

    1 回复  |  直到 13 年前
        1
  •  1
  •   stukselbax    13 年前

    主要想法是创建自己的 文本装饰 满足您的具体需求。

    <TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" 
               TextWrapping="Wrap" Width="276">
        Hello world. This is some text. This is an
        <Span BaselineAlignment="Bottom">
            <Span.TextDecorations>
                <TextDecoration Location="OverLine" PenOffset="1" PenOffsetUnit="Pixel" />
            </Span.TextDecorations>
            OVERLINE
        </Span>
    </TextBlock>
    
    推荐文章