[UWP]如何为图像添加边距? [英] [UWP] How to add a margin to an image??

查看:86
本文介绍了[UWP]如何为图像添加边距?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我是C#的新手,现在正在开发一款带有UWP(win10)的应用程序。

I am quite new to C# and now developing an app with UWP (win10).

我的目的是为图像添加一个边距作为位图如下,但它看起来有点错误或太慢,所以循环没有完成....

My purpose of the class is to add a margin to an image as bitmap as follows however it seems something wrong or too slow and so the loop doesn't complete....

有没有更好更快的想法?

Is the any way much better and faster ideas??

推荐答案

您好Rukaruka,

Hi Rukaruka,

您想在图片周围添加边框吗?

Do you want to add a border around the image?

如果是这样,我认为最简单的方法是在xaml中设计它,类似于下面的代码,

If that, I think the simplest method is to design it in the xaml similar to the following code,

        <Border BorderBrush="Red"
        BorderThickness="15"
        Background="AliceBlue"
        CornerRadius="15">
            <!--<Border.Background>
                <ImageBrush ImageSource="Assets/StoreLogo.png" />
            </Border.Background>-->
            <Image Width="250" Height="250" Margin="10" Source="Assets/image.png"/>
        </Border>

如果不是您想要的效果,您能否向我提供有关您问题的更多详细信息?比如你想要实现的完整代码或效果图片?

If it is not the effect you want, could you give me more details about your issue? Such as the full code or the effect picture you want to achieve?

祝你好运,

Breeze


这篇关于[UWP]如何为图像添加边距?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆