我试图创建一个带有空白图片的着色书,我希望能够用一种颜色填充图像的一部分,但我无法弄清楚如何在UWP中这样做(C# / XAML)
答案 0 :(得分:0)
你想要将照片分成不同的图像。然后你可以用一种颜色填充每个人的前景。这应该可以帮到你。
XAML查看:
<Grid>
<BitmapIcon Name="PokeTail" UriSource="/Assets/Graphics/PokemonTail.png" Foreground="{Binding PokemonTailColor}" Tapped="PokeTail_Tapped" RightTapped="PokeTail_RightTapped" />
<BitmapIcon Name="PokeHead" UriSource="/Assets/Graphics/PokemonHead.png" Foreground="{Binding PokemonHeadColor}" Tapped="PokeHead_Tapped" RightTapped="PokeHead_RightTapped" />
<Image Name="PokeOutline" Source="/Assets/Graphics/PokemonOutline.png"/>
</Grid>
C#代码背后:
private void PokeHead_Tapped(object sender, TappedRoutedEventArgs e)
{
PokeHead.Foreground = new SolidColorBrush(Colors.Yellow);
}
private void PokeHead_RightTapped(object sender, RightTappedRoutedEventArgs e)
{
PokeHead.Foreground = new SolidColorBrush(Colors.Transparent);
}
private void PokeTail_Tapped(object sender, TappedRoutedEventArgs e)
{
PokeTail.Foreground = new SolidColorBrush(Colors.Wheat);
}
private void PokeTail_RightTapped(object sender, RightTappedRoutedEventArgs e)
{
PokeHead.Foreground = new SolidColorBrush(Colors.Transparent);
}