http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/aspnet-globalarchi.asp
解决方案 »
- 如何确保程序的运行速度稳定
- 线程的关闭问题。。
- 如何操作access数据库,创建一个表?
- 多参数有返回值函数怎么写?
- “ 并非所有的代码路径都返回值”这个问题怎么解决?
- webbrowser自动填表,点击总是无效
- C#windows窗体应用程序打包成exe文件
- 如何同时播放两个声音??
- 在Windows.Net Server下开发Web程序配置的问题? 50分
- vs.net的中文正式版出来了没?如果没出,是否有哪位知道微软什么时候出中文版?
- Web用户控件取值问题
- 我在机器上新建一个C#的控制台应用程序的工程,提示automation服务器不能创建对象,这是什么原因啊,怎么解决啊,谢谢,解决后立即给分
{
Hashtable resources;
public Res()
{
resources = new Hashtable();
ResXResourceReader rx = new ResXResourceReader("Resource.resx");
IDictionaryEnumerator n = rx.GetEnumerator();
while (n.MoveNext())
{
if (!resources.ContainsKey(n.Key))
{
resources.Add(n.Key, n.Value);
}
}
rx.Close();
} public string GetString(string name)
{
return (string)resources[name];
}
}
Hashtable resources;
public Res()
{
resources = new Hashtable();
ResXResourceReader rx = new ResXResourceReader("Resource.resx");
IDictionaryEnumerator n = rx.GetEnumerator();
while (n.MoveNext())
{
if (!resources.ContainsKey(n.Key))
{
resources.Add(n.Key, n.Value);
}
}
rx.Close();
} public string GetString(string name)
{
return (string)resources[name];
}
}
添加引用了没有。
用using进行说明了没有。在MSDN中查看ResXResourceReader所在的命名空间,MSDN有例子。
using System;
using System.Drawing;
using System.Resources;
public class MainApp
{
public static void Main()
{
Image img = Image.FromFile("en-AU.jpg");
ResXResourceWriter rsxw = new ResXResourceWriter("en-AU.resx");
rsxw.AddResource("en-AU.jpg",img);
rsxw.Close();
}
}
顺便推荐一个制作资源文件的工具http://www.guohuasoft.com.