- UID
- 658062
- 积分
- 2147
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2008-10-22
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
引用 using System.Resources;
写资源文件代码如下:
ResourceWriter rw = new ResourceWriter("Greeting1.dll");
Bitmap b = new Bitmap("hhw.gif");
//add some strings to the file
//rw.AddResource("Greeting", "Welcome to Microsoft .Net Framework!Test");
//rw.AddResource("PasswordException", "Sorry, that is not the correct password.");
//rw.AddResource("Purchase", "Please select an item to purchase from the store:");
//rw.AddResource("Goodbye", "Thank you for visiting Microsoft .Net Framework!");
rw.AddResource("flag",b );
rw.Generate();
rw.Close();
读资源代码
ResourceReader rr = new ResourceReader("Greeting1.dll");
String s = "";
//iterate through the reader, printing out the name-value pairs
foreach (DictionaryEntry d in rr)
{
Console.WriteLine(d.Key + ":" + d.Value.ToString ()) ;
if (d.Key.ToString () == "flag")
{
Bitmap b = new Bitmap((Bitmap)d.Value);
b.Save("a.gif");
break;
}
}
//close the reader
rr.Close();
|
|