wpf 裁剪超出容器的部分

该方法可适用于所欲容器类型,相关属性:ClipToBounds 

举例:

代码:

<Canvas ClipToBounds="False" Height="100" Width="100" Background="Yellow">
  <Ellipse Fill="Green" Height="100" Width="100" Canvas.Left="60"/>
</Canvas>

结果:

 

 


 

代码:

<Canvas ClipToBounds="True" Height="100" Width="100" Background="Yellow">
  <Ellipse Fill="Green" Height="100" Width="100" Canvas.Left="60"/>
</Canvas>

结果:

 

posted @ 2020-11-15 22:50  蜜铀  阅读(367)  评论(0编辑  收藏  举报