2

Windows Phone 8 でテキストのアウトラインを作成することはできますか?たとえば、テキストが赤いのに、アウトラインを黒くしたい

C#のxamlでこれを行う必要がありますか?また、可能であればどのようにしますか? どんな例でも大歓迎です

ありがとう

4

2 に答える 2

2

ここで、それがどのように行われたかを見ることができます: http://blog.mrlacey.co.uk/2010/06/silverlight-effects-and-windows-phone-7.html

もう機能していません。パフォーマンスの問題により、マイクロソフトはそれを削除しました。

アプリケーションがこれらの効果を使用することでパフォーマンスに影響を与えると、システムに過度の負担がかかります。パフォーマンスの高い機能を提供できない場合は、できる限り無効にすることにしました。

唯一の可能性は、2 つの TextBlocks を作成し、FontSize、RenderTransfor、FontWeight を変更することです...

<TextBlock Text="{Binding ElementName=BackgroundText,Path=Text}" FontSize="25" Foreground="Red" FontWeight="ExtraBold">
</TextBlock>
<TextBlock Text="Hello" Name="BackgroundText" FontSize="25" Foreground="White" FontWeight="Bold">
<TextBlock.RenderTransform>
    <TranslateTransform X="0.5" Y="0" />
</TextBlock.RenderTransform>
</TextBlock>
</TextBlock>
于 2013-07-12T11:32:18.887 に答える
1

FontWieghts が異なる 2 つの TextBlocks は大きなテキスト (単純な「Hello」よりも長い) には役立たないため、太字のテキストが細いテキストより先に表示されるため、左上、右上に 1 ずつずらした 4 つの TextBlocks を使用することをお勧めします。 Opacity = 0.5 に設定して輪郭を滑らかにします。ここに例があります:

        <TextBlock Grid.Row="0" Text="Outlined text" Style="{StaticResource OutlineTb}">
        <TextBlock.RenderTransform>
            <TranslateTransform X="-1" Y="1" />
        </TextBlock.RenderTransform>
    </TextBlock>
    <TextBlock Grid.Row="0" Text="Outlined text" Style="{StaticResource OutlineTb}">
        <TextBlock.RenderTransform>
            <TranslateTransform X="-1" Y="-1" />
        </TextBlock.RenderTransform>
    </TextBlock>
    <TextBlock Grid.Row="0" Text="Outlined text" Style="{StaticResource OutlineTb}">
        <TextBlock.RenderTransform>
            <TranslateTransform X="1" Y="-1" />
        </TextBlock.RenderTransform>
    </TextBlock>
    <TextBlock Grid.Row="0" Text="Outlined text" Style="{StaticResource OutlineTb}">
        <TextBlock.RenderTransform>
            <TranslateTransform X="1" Y="1" />
        </TextBlock.RenderTransform>
    </TextBlock>

    <TextBlock Grid.Row="0"
               Text="Outlined text"
               FontSize="25"
               Foreground="White"
               FontWeight="Normal">
    </TextBlock>

そしてスタイル:

    <Style TargetType="TextBlock" x:Key="OutlineTb">
        <Setter Property="FontSize" Value="25" />
        <Setter Property="Foreground" Value="Black" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="Opacity" Value="0.5" />
    </Style>

ただし、これは非常に「重い」ソリューションであり、それでも本物のアウトラインほど優れていないことに注意してください。

于 2015-02-11T06:54:15.950 に答える