Properties.Resources不加载图像 [英] Properties.Resources not loading an image

查看:736
本文介绍了Properties.Resources不加载图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio 2012 C#的游戏应用。我有所有我在项目中使用的资源文件。PNG图像。

I have a game application in Visual Studio 2012 C#. I have all the .png images I am using in the Resources file of the project.

你有任何想法,为什么我可以访问所有文件,但其用Properties.Resources?

Have you any idea why I can access all the files but one by using Properties.Resources?

我查了完整的文件路径和它的设置到资源文件夹。而且它在程序添加像我一样添加 - >现有项目并添加图片

I checked the full filePath and it's set to the resources folder. And it's added in the program as I did Add -> Existing Item and added the image.

它看起来就像其他的图像。我不知道为什么它不加载。我需要这个,因为我需要通过电子邮件发送一个.exe文件到我的讲师,没有这个形象的项目是什么

It looks just like the other images. I have no idea why it's not loading. I need this since I need to send a .exe by email to my lecturer and without this image the project is nothing!

我添加了这个资源文件

internal static System.Drawing.Bitmap grid_fw {
            get
            {
                object obj = ResourceManager.GetObject("grid.fw", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

和虽然现在电网可用,则返回null :/

and although now grid is available, it is returning null :/

推荐答案

从实测值的 Properties.Resources图标名称不会出现在智能感知

您还需要将图标添加到 Resources.resx 文件。在
Visual Studio中打开它,你的图标拖入RESX和
将成为可用的图标菜单。

You also need to add the icon to the Resources.resx file. Open it in Visual Studio and drag your icon into the Icons menu of the resx and it will become available.

此外,请参阅添加和编辑资源(的Visual C# )

这篇关于Properties.Resources不加载图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆