怎样使用资源文件? 声音文件可放入资源文件吗?如何调用?如何使.resources资源文件嵌入项目?作为内嵌的资源文件,程序中如何初始化来调用它? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我使用al工具来生成本地资源的DLL了,可运行时还是出现找不到资源文件错误? 感谢您使用微软的产品。您可以通过使用resourcer这个资源管理工具来生成resource文件,然后在程序中读取。假设resource文件名为sound.resources,其中包含一个name为“Chimes",type为System.Byte[]的wav文件。已经添加到project中。具体的代码如下:Assembly thisAssembly = Assembly.GetAssembly(Type.GetType("resSound.Form1"));ResourceManager rm= new ResourceManager("resSound.sound",thisAssembly); System.Byte[] sound;sound=(System.Byte[])rm.GetObject("Chimes"); System.Byte[] snd =new System.Byte[sound.GetLength(0)]; sndPlaySound(sound[0].ToString(),1);//这个函数就和上次跟你说的是一样的。resourcer程序可以在下面这个url下载:http://www.aisto.com/roeder/dotnet/download.asp?File=resourcer.zip- 微软全球技术中心 VB技术支持本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利。具体事项可参见使用条款(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。为了为您创建更好的讨论环境,请参加我们的用户满意度调查(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。 多谢xinsb([微软]小楼一夜听春雨),但我还有点没搞懂:Assembly thisAssembly = Assembly.GetAssembly(Type.GetType("resSound.Form1"));中,resSound.Form1是使用AL工具输出的resSound.Form1.Dll名吗?还是其它的?在STUDIO中,把resources文件加入项目中,并将其属性设为嵌入,是否就可以不用AL工具了? 忘了一点,还有:ResourceManager rm= new ResourceManager("resSound.sound",thisAssembly);中,resSound.sound的名称是从哪来的? 感谢您使用微软的产品。Assembly thisAssembly = Assembly.GetAssembly(Type.GetType("resSound.Form1"));中,resSound.Form1就是指resSound这个namespace下的Form1这个类。您只要把您自己定义的namespace.classname字符串替代掉就可以了。ResourceManager rm= new ResourceManager("resSound.sound",thisAssembly);中,resSound.sound是指resSound这个namespace下的,sound.resource这个resource文件,您可以用您自己的namespace.resourcefilename替代掉。- 微软全球技术中心 VB技术支持本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利。具体事项可参见使用条款(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。为了为您创建更好的讨论环境,请参加我们的用户满意度调查(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。 waki(不老先生):我碰到类似问题,但我的资源文件是从其他项目中copy过来的,添加至我的项目中就不能用了,出错信息:未处理的“System.Resources.MissingManifestResourceException”类型的异常出现在 mscorlib.dll 中其他信息:未能在给定的程序集中找到任何适合于指定的区域性(或非特定区域性)的资源。请确保已将“xpmeau.resources”正确嵌入或链接到程序集“xpmeau”。baseName: xpmeau locationInfo: <null> resource file name: xpmeau.resources assembly: xpmeau, Version=1.0.591.19296, Culture=neutral, PublicKeyToken=null要怎么办呢,快帮帮我,我写了贴子,快来回答,100分 我这个vs 20008好像是在安装sql server 2008时顺带安装的,为什么没有C#项目呢 求助关于C#与COM的问题?? listBox1.SelectedItem.ToString()取值的问题 跪求!解决方案![200]另开帖补够! 怎样通过拖拽改变Panel的大小 关于正则表达式的简单替换问题 C# 中如何限制图片控件的大小 请教Excel的列数据统计问题 我想在一个文件前面加入几个字节,请问怎么实现? 如何用C#设计支持脚本编辑的测试执行程序? 菜鸟一问 为什么我使用资源文件出错?
System.Byte[] sound;
sound=(System.Byte[])rm.GetObject("Chimes");
System.Byte[] snd =new System.Byte[sound.GetLength(0)];
sndPlaySound(sound[0].ToString(),1);//这个函数就和上次跟你说的是一样的。resourcer程序可以在下面这个url下载:http://www.aisto.com/roeder/dotnet/download.asp?File=resourcer.zip
- 微软全球技术中心 VB技术支持本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利。具体事项可参见使用条款
(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。
为了为您创建更好的讨论环境,请参加我们的用户满意度调查
(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。
Assembly thisAssembly = Assembly.GetAssembly(Type.GetType("resSound.Form1"));中,resSound.Form1是使用AL工具输出的resSound.Form1.Dll名吗?还是其它的?
在STUDIO中,把resources文件加入项目中,并将其属性设为嵌入,是否就可以不用AL工具了?
ResourceManager rm= new ResourceManager("resSound.sound",thisAssembly);中,resSound.sound的名称是从哪来的?
(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。
为了为您创建更好的讨论环境,请参加我们的用户满意度调查
(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。
baseName: xpmeau locationInfo: <null> resource file name: xpmeau.resources assembly: xpmeau, Version=1.0.591.19296, Culture=neutral, PublicKeyToken=null要怎么办呢,快帮帮我,我写了贴子,快来回答,100分