.resources是.Net的资源文件
你可以使用System.Resources 命名空间下面的类来对资源文件进行处理ResourceManager 类使用户可以访问和控制在主程序集或在资源附属程序集中存储的资源。使用 ResourceManager.GetObject 和 ResourceManager.GetString 方法检索特定于区域性的对象和字符串ResourceWriter 以系统默认的格式将资源写入输出文件或输出流。 ResourceWriter 以系统默认的格式将资源写入输出文件或输出流。
参考:读取资源文件:
http://cht.gotdotnet.com/quickstart/util/srcview.aspx?path=%2fquickstart%2fhowto%2fsamples%2fresources%2freadwriteresources%2freadwriteresources.src创建和使用资源:
http://cht.gotdotnet.com/quickstart/util/srcview.aspx?path=%2fquickstart%2fhowto%2fsamples%2fresources%2fcreateresources%2fcreateresources.src创建一个资源文件:
Imports System
Imports System.ResourcesPublic Class WriteResources
Public Shared Sub Main()
' Creates a resource writer.
Dim writer As New ResourceWriter("myResources.resources")
' Adds resources to the resource writer.
writer.AddResource("String 1", "First String")
writer.AddResource("String 2", "Second String")
writer.AddResource("String 3", "Third String")
' Writes the resources to the file or stream, and closes it.
writer.Close()
End Sub
End Class读取一个资源文件:
Imports System
Imports System.Resources
Imports System.CollectionsPublic Class ReadResources
Public Shared Sub Main()
' Opens a resource reader and get an enumerator from it.
Dim reader As New ResourceReader("myResources.resources")
Dim en As IDictionaryEnumerator = reader.GetEnumerator()
' Goes through the enumerator, printing out the key and value pairs.
While en.MoveNext()
Console.WriteLine()
Console.WriteLine("Name: {0}", en.Key)
Console.WriteLine("Value: {0}", en.Value)
End While
reader.Close()
End Sub
End Class
更多内容:
ms-help://MS.VSCC/MS.MSDNVS.2052/cpref/html/frlrfSystemResources.htmms-help://MS.VSCC/MS.MSDNVS.2052/Cpqstart/html/cpsmpnetsamples-aspnetlocalization.htmms-help://MS.VSCC/MS.MSDNVS.2052/cpguide/html/cpcondesigningglobalapplications.htm
你可以使用System.Resources 命名空间下面的类来对资源文件进行处理ResourceManager 类使用户可以访问和控制在主程序集或在资源附属程序集中存储的资源。使用 ResourceManager.GetObject 和 ResourceManager.GetString 方法检索特定于区域性的对象和字符串ResourceWriter 以系统默认的格式将资源写入输出文件或输出流。 ResourceWriter 以系统默认的格式将资源写入输出文件或输出流。
参考:读取资源文件:
http://cht.gotdotnet.com/quickstart/util/srcview.aspx?path=%2fquickstart%2fhowto%2fsamples%2fresources%2freadwriteresources%2freadwriteresources.src创建和使用资源:
http://cht.gotdotnet.com/quickstart/util/srcview.aspx?path=%2fquickstart%2fhowto%2fsamples%2fresources%2fcreateresources%2fcreateresources.src创建一个资源文件:
Imports System
Imports System.ResourcesPublic Class WriteResources
Public Shared Sub Main()
' Creates a resource writer.
Dim writer As New ResourceWriter("myResources.resources")
' Adds resources to the resource writer.
writer.AddResource("String 1", "First String")
writer.AddResource("String 2", "Second String")
writer.AddResource("String 3", "Third String")
' Writes the resources to the file or stream, and closes it.
writer.Close()
End Sub
End Class读取一个资源文件:
Imports System
Imports System.Resources
Imports System.CollectionsPublic Class ReadResources
Public Shared Sub Main()
' Opens a resource reader and get an enumerator from it.
Dim reader As New ResourceReader("myResources.resources")
Dim en As IDictionaryEnumerator = reader.GetEnumerator()
' Goes through the enumerator, printing out the key and value pairs.
While en.MoveNext()
Console.WriteLine()
Console.WriteLine("Name: {0}", en.Key)
Console.WriteLine("Value: {0}", en.Value)
End While
reader.Close()
End Sub
End Class
更多内容:
ms-help://MS.VSCC/MS.MSDNVS.2052/cpref/html/frlrfSystemResources.htmms-help://MS.VSCC/MS.MSDNVS.2052/Cpqstart/html/cpsmpnetsamples-aspnetlocalization.htmms-help://MS.VSCC/MS.MSDNVS.2052/cpguide/html/cpcondesigningglobalapplications.htm
解决方案 »
- ImageMap 显示热点区域的边框线
- 用程序怎么实现导出导入ORACLE的表空间
- asp.net 注销
- (高分)关于RBAC模型应用在网站CMS上哪种更合理,可以为注册用户使用这种模型吗?
- 在上传图片的同时,实现图片的预览!
- *︻$▅▆▇◤ (36分捉拿高手)关于utf-8与gb2312的转换关系
- 急!!在线等!请各位大侠帮帮忙!我已经建立好了虚拟目录并且把.aspx文件设为了启始页在执行不调试时显示如下错误:“/SimpleControlDataBind
- 内容页实用RadioButton
- ASP.NET程序可以访问共享的目录,但不能访问映射驱动器
- 请问大家开发一个asp.net项目一般需要多长时间?
- 怎么用Javascript读取WEB service 的数据?
- 关于web控件table的使用
ResourceWriter rw=new ResourceWriter("sample.resources");
Bitmap b=new Bitmap("shy.gif");
rw.AddResource("flag",b);
rw.AddResource("name","Jack");
rw.Generate();
//读资源ResourceManager rm=new ResourceManager("sample",System.Reflection.Assembly.GetExecutingAssembly());
string strname=rm.GetString("name",);
Bitmap b=(Bitmap)rm.GetObject("flag");
this.button1.Text=strname;
this.pictureBox1.Image=b;
http://www.codeproject.com/cs/miscctrl/resource_editor.asp?target=resource