简体   繁体   English

使用导入的图像资源进行编译时出错

[英]I get an error when compiling with an imported image resource

This is turning into a nightmare! 这变成了一场噩梦!

I have a C# DLL project and it has the regular About Form. 我有一个C#DLL项目,它有常规的About Form。 I go to add my own image: 我去添加我自己的图像:

在此输入图像描述

I can see it listed and I accept: 我可以看到它列出,我接受:

在此输入图像描述

It looks fine: 看起来很好:

在此输入图像描述

The moment I compile I get this error: 我编译的那一刻我得到这个错误:

在此输入图像描述

I have googled the error: 我用Google搜索了错误:

The argument docData must implement the interface IVsTextStream 参数docData必须实现接口IVsTextStream

And it suggests deleting the RES file. 它建议删除RES文件。

I am confused. 我很困惑。 I thought this would be a simple exercise and despite several attempts and can't use my own image. 我认为这将是一个简单的练习,尽管有几次尝试,但不能使用我自己的图像。

Well, I do not know why the problem was happening. 好吧,我不知道为什么会出现这个问题。 But here is my workaround: 但这是我的解决方法:

  1. I created a new C# DLL project. 我创建了一个新的C#DLL项目。
  2. I added the About Form. 我添加了关于表格。
  3. I opened the form RESX file in the IDE. 我在IDE中打开了表单RESX文件。
  4. I added the new image. 我添加了新图片。
  5. I set the image as embedded. 我将图像设置为嵌入式。
  6. I deleted the existing image. 我删除了现有的图像。
  7. I renamed the new image the same as the old. 我将新图像重命名为旧图像。
  8. I restarted the project and the image showed fine. 我重新启动了项目,图像显示正常。
  9. I opened the RESX file with NotePad++ and copied the image bit over to my actual project about window RESX file. 我用NotePad ++打开了RESX文件,并将图像位复制到我关于窗口RESX文件的实际项目中。
  10. It displays and compiles. 它显示和编译。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM