首页 > 技术文章 > WPF 后台使用资源图片

qq2806933146xiaobai 2022-01-15 18:42 原文

一般使用:

 Img.Image = new BitmapImage(new Uri("/Resources/列表循环_白.png", UriKind.Relative));

找不到时,使用:

 Img.ImageSource = new BitmapImage(new Uri("pack://application:,,,/MovieDesktop;component/Resources/列表循环_白.png", UriKind.Absolute));

注意把Resources中的资源图片设置为始终复制-资源;

推荐阅读