gpt4 book ai didi

windows-phone-7 - 在 C# 中将堆栈面板的背景设置为图像

转载 作者:行者123 更新时间:2023-12-04 07:10:04 24 4
gpt4 key购买 nike

我需要将 StackpanelBackground 设置为资源中的一些图像。
我知道我应该按如下方式设置背景:

Stack.Background= image; // don't know of what type the image should be how to set it   

感谢任何帮助,

最佳答案

string fileName = "/Background.png";
BitmapImage image = new BitmapImage(new Uri(fileName, UriKind.Relative));
ImageBrush brush = new ImageBrush();
brush.ImageSource = image;
stack.Background = brush;

关于windows-phone-7 - 在 C# 中将堆栈面板的背景设置为图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7498756/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com