4

<Span TextDecorations="Overline" BaselineAlignment="Bottom">在 TextBlock 内使用:

<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>

生产:

截屏

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

在此处输入图像描述

非常微妙的下移,我知道。

4

1 回答 1

1

主要思想是根据您的特定需求创建自己的TextDecoration

<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>
于 2013-03-20T17:10:04.320 回答