gpt4 book ai didi

c# - 静态资源图像在运行时不出现(在设计时)

转载 作者:太空宇宙 更新时间:2023-11-03 10:58:35 25 4
gpt4 key购买 nike

我在我的 WPF 应用程序中设置了静态资源,如下所示:

<Application x:Class="Demos.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
<BitmapImage x:Key="logo" UriSource="Logo.png" />
</Application.Resources>
</Application>

我可以通过以下声明看到在设计时出现的图像:

<Image HorizontalAlignment="Left" Height="302" Margin="0,-106,0,0" VerticalAlignment="Top" Width="458" Source="{StaticResource logo}" Grid.RowSpan="2"/>

但是当我运行我的应用程序时,图像没有出现。知道我做错了什么吗?

提前致谢!

最佳答案

图像属性设为资源并从属性窗口始终复制。希望这能解决您的问题。

关于c# - 静态资源图像在运行时不出现(在设计时),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18553481/

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