5

我试图直观地看到align2 个(或更多)块的内容的顶部Text。用户可以修改每个块的内容和FontSize, Family, )。Weight

我尝试使用GetCellAscent,GetCellDescentGetLineSpacing函数,但结果仅取决于字体而不是实际内容。无论如何,我找不到块的顶部和底部之间的差异是如何分布LineSpacingAscent+ Descent

例如我想产生这种输出:

在此处输入图像描述

有什么帮助吗?

4

1 回答 1

1

尝试这个.....

   <Grid Width="171" Height="100" Background="Black" Margin="257,78,75,133">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />

        </Grid.RowDefinitions>

        <TextBlock Name="aaa" Text="12" FontSize="40" HorizontalAlignment="Center"  VerticalAlignment="Stretch" Grid.Row="1"   FontWeight="Bold"   Foreground="White" />
        <TextBlock Text="$" HorizontalAlignment="Left" FontSize="20" Grid.Column="1" FontFamily="Euphemia" FontWeight="Bold" Foreground="White" Margin="8,0,72,0" />
        <TextBlock Text="00 le Kg" FontSize="15" Grid.Column="1" Grid.Row="3" HorizontalAlignment="Left" Grid.IsSharedSizeScope="True" FontFamily="Euphemia" FontWeight="Bold" Foreground="White"/>

    </Grid>
于 2013-04-09T10:36:30.720 回答