繁体   English   中英

在WPF和Blend中添加纹理形状

[英]adding texture to shape in WPF and Blend

如何在矩形上添加纹理,例如在画布上拉伸对象时会在调整大小时覆盖它?

谢谢

不是说我在乎负面点,而是那些至少离开这种得分的人通过指出一个解决方案可能会有所帮助,因为他们认为这是一个低级的问题,所以我假设他们知道答案。 我已经搜索了xaml的blend 4和相关主题,但没有找到方向。

将图像添加为用于填充矩形的图像画笔:

<Rectangle Width="auto" Height="auto" Name="myRectangle">
    <Rectangle.Fill>
        <ImageBrush ImageSource="C:\Users\Public\Pictures\Sample Pictures\sample.gif"/>
    </Rectangle.Fill>
</Rectangle>

源: http : //social.msdn.microsoft.com/Forums/en/wpf/thread/4c70e94b-23a1-4533-9332-eaa08bcf113d

输出:

图片来源: http : //googleblog.blogspot.com/2012/03/bringing-self-driving-cars-to-nascar.html

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM