WPF Border头像圆角边缘裁剪

临时马上用,有空再封装
应该没有空

宽度为 100 注意匹配
圆角为 10 注意匹配
边框粗细为2
剪切的半径为11(圆角+边框粗细/2)

<Window
x:Class="WpfApp2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WpfApp2"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="MainWindow"
Width="800"
Height="450"
mc:Ignorable="d">
<Grid>
<Border
Width="100"
Height="100"
CornerRadius="10">
<Border.Clip>
<RectangleGeometry
RadiusX="11"
RadiusY="11"
Rect="0,0,100,100" />
</Border.Clip>
<Image Source="E:\TrykleCgTool\bin\Debug\tools\101\icon.png" />
</Border>
<Border
Width="100"
Height="100"
BorderBrush="Red"
BorderThickness="2"
CornerRadius="10" />
</Grid>
</Window>
posted @   trykle  阅读(218)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示