更新时间:2023-02-15 19:17:50
不要将图像添加为资源.我宁愿执行以下操作:
创建图像/图标并将其保存到文件中
选择项目->添加现有项并添加文件
将构建操作"设置为嵌入式资源"
然后,您可以使用
访问此资源
Don''t add the image as a resource. I would rather do the following:
Create the image/icon and save it to a file
Choose Project -> Add Existing Item and add the file
Set the Build Action to Embedded Resource
You can then access this resource using
Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceUri)
这样,就不会将图像神奇地添加到项目资源文件中,并且您将只在程序集的资源中存储图像的一个副本.
This way the image is not magically added to the projects resource file and you will only have one copy of the image stored in the assembly''s resources.