[英]Codedom add resource
I'm compiling some source (it's a wpf window) with codedom. 我正在用codedom编译一些源(这是一个wpf窗口)。 Now I want to add some resources (images) without dropping the file first.
现在,我想添加一些资源(图像)而不先删除文件。 Is that possible?
那可能吗?
If yes, how? 如果是,怎么办? And how can i access the images within the new application?
我如何在新应用程序中访问图像?
On request some more detailed informations: 根据要求提供一些更详细的信息:
User can enter / select some data. 用户可以输入/选择一些数据。 After that, the user can click compile which creates a custom application (wpf).
此后,用户可以单击编译以创建自定义应用程序(wpf)。
Now I want to add some image resources at compiling, so that I can create a nicer GUI for the dynamic created application. 现在,我想在编译时添加一些图像资源,以便为动态创建的应用程序创建更好的GUI。
Okay, i managed the problem finaly. 好吧,我最终解决了问题。
I converted the image to an byte array, then wrote a new Resource (with ResourceWriter) and finally (CompilerParameters)EmbeddedResources.Add. 我将图像转换为字节数组,然后编写了一个新的Resource(使用ResourceWriter),最后编写了(CompilerParameters)EmbeddedResources.Add。
In the created WPF Window I grab the array, convert it back to an BitmapImage and assign it to an image control. 在创建的WPF窗口中,我抓取数组,将其转换回BitmapImage并将其分配给图像控件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.