如何用图块填充 Win10 XAML 多边形? [英] How to fill a Win10 XAML Polygon with tiles?

查看:25
本文介绍了如何用图块填充 Win10 XAML 多边形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使 XAML 多边形填充转换后的纹理.该代码在 WPF 中运行良好,但在 Windows 10 应用中似乎没有 TileMode 属性.

I am trying to make XAML Polygon filled with a transformed texture. The code worked well in WPF but in a Windows 10 app there seems to be no TileMode property.

 <Polygon Points="300,200 400,125 400,275" Stroke="Purple" StrokeThickness="2">
        <Polygon.Fill>
            <ImageBrush TileMode="Tile" ImageSource="Assets/StoreLogo.png">
                <ImageBrush.RelativeTransform>
                    <TransformGroup>
                        <ScaleTransform CenterY="0.5" CenterX="0.5" ScaleX="0.2" ScaleY="0.2"/>
                        <SkewTransform CenterY="0.5" CenterX="0.5"/>
                        <RotateTransform CenterY="0.5" CenterX="0.5" Angle="61.928"/>
                        <TranslateTransform/>
                    </TransformGroup>
                </ImageBrush.RelativeTransform>
            </ImageBrush>
        </Polygon.Fill>
    </Polygon> 

推荐答案

您可以使用 Win2D 平铺图书馆.他们也有示例代码;效果"下有一个平铺示例 (EffectsSample.xaml.cs).

You can tile using the Win2D library. They have sample code as well; there's a tiling sample under "effects" (EffectsSample.xaml.cs).

这篇关于如何用图块填充 Win10 XAML 多边形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆