图像上的圆形边框不均匀

时间:2015-12-30 16:04:23

标签: c# xaml silverlight windows-phone-8.1

我正在尝试为Windows Phone 8.1 silverlight项目显示带有某种颜色的圆形边框的图像,但是当应用剪辑时,图像重叠在边框的边缘,是否有任何方法可以实现均匀的边框在图像上?使用下面的xaml模板

这是我的xaml

       <Grid Background="Transparent" Width="200" Height="200">
            <Grid.Clip>
                <RectangleGeometry Rect="0,0,200,200" RadiusX="100" RadiusY="100"/>
            </Grid.Clip>
            <Border x:Name="Border1" 
                BorderThickness="4"
                BorderBrush="Red"
                Background="Green"
                CornerRadius="100">

                <Grid Background="Yellow">
                    <ContentPresenter>
                        <Image Source="http://joombig.com/demo-extensions1/images/gallery_slider/Swan_large.jpg" 
                               Stretch="UniformToFill">
                        </Image>
                    </ContentPresenter>
                </Grid>
            </Border>
        </Grid>

请检查以下输出图像

https://onedrive.live.com/redir?resid=2F14B4EE5F346B6F%215535

2 个答案:

答案 0 :(得分:2)

我总是倾向于使用Ellipse,所以尝试这样的事情(笔触属性是你想要的圆圈边界)

for ($row = 1; $row <= 10; ++$row) {
    $objPHPExcel->getActiveSheet()
        ->setCellValue(
            'C' . $row, 
            '=A' . $row . '*B' . $row
        );
}

答案 1 :(得分:0)

我能够通过删除内边框并添加另一个边框作为内部网格的兄弟来实现它的工作

   <Grid Background="Transparent" Width="200" Height="200">
        <Grid.Clip>
            <RectangleGeometry Rect="0,0,200,200" RadiusX="100" RadiusY="100"/>
        </Grid.Clip>
        <Grid Background="Yellow">
            <ContentPresenter>
                <Image Source="http://joombig.com/demo-extensions1/images/gallery_slider/Swan_large.jpg" Stretch="UniformToFill"/>
            </ContentPresenter>
        </Grid>
        <Border x:Name="CircularBorder" BorderThickness="10" BorderBrush="Red" Background="Transparent" CornerRadius="100" IsHitTestVisible="False"/>
    </Grid>
相关问题