WPF 的嵌入式资源的读取


当文件属性的生成操作设置为嵌入资源(Embedded Resource)时,读取方式如下:

                string name = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name + @"Resource\dhxy2\lianyao_touch.png"; System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); System.IO.Stream stream = assembly.GetManifestResourceStream(name);

当文件属性的生成操作设置为资源(Resource)时,读取方式如下:

                Uri uri = new Uri(@"Resource\dhxy2\lianyao_touch.png", UriKind.Relative); StreamResourceInfo info = Application.GetResourceStream(uri);

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM