开发者

Can XAML be used to copy areas of other images?

I'm looking to us开发者_高级运维e xaml as a way to access spritesheet.

Is xaml capable of referencing a png file and displaying just a portion of that file?


You should be able to use the following (where you change the composite transform attributes for the sprite offset):

<Rectangle x:Name="R" Width="20" Height="20" >
 <Rectangle.Fill>
  <ImageBrush ImageSource="Spritesheet.png" Stretch="None" AlignmentX="Left" AlignmentY="Top" >
   <ImageBrush.Transform>
    <CompositeTransform TranslateX="-20" TranslateY="-20"/>
   </ImageBrush.Transform>
  </ImageBrush>
 </Rectangle.Fill>
</Rectangle>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜