将背景设置为画布 [英] Set Background to canvas

查看:23
本文介绍了将背景设置为画布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在字符串路径上设置背景?

how i can set background on string path?

canvas1.Background = "/path/";

请帮忙!!!谢谢:)

推荐答案

我认为您正在寻找 ImageBrush 类:

I think you are looking for the ImageBrush class:

ImageBrush imageBrush = new ImageBrush();
imageBrush.ImageSource = new BitmapImage(new Uri(@"/path/", UriKind.Relative));
canvas1.Background = imageBrush;

这篇关于将背景设置为画布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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