原文地址:
http://foxhound.blogbus.com/logs/63497357.html
一、常用方法(已确认):
2 | pictureBox1.Image = Properties.Resources.Correct; |
二、使用 ResourceManager 类的方法(已确认):
02 | ResourceManager resourceManager = new ResourceManager( "资源名称" , Assembly.GetExecutingAssembly()); |
05 | ResourceManager resourceManager = new ResourceManager( typeof (About)); |
08 | ResourceManager resourceManager = Properties.Resources.ResourceManager; |
11 | Object target = resourceManager.GetObject( "资源文件名" ); |
三、反射法(未确认):
1 | Assembly assembly = this .GetType().Assembly; |
2 | Stream stream = assembly.GetManifestResourceStream( "Draw.Resources.Correct.jpg" ); |
3 | this .BackgroundImage = new Bitmap(stream); |
四、资源文件读取类(未确认,可能会出问题):
01 | using (ResXResourceReader reader = new ResXResourceReader( @"About.resx" )) |
03 | foreach (DictionaryEntry entry in reader) |
05 | if (entry.Key.ToString() == "MyName" ) |
07 | this .label2.Text = entry.Value.ToString(); |
posted on 2010-12-31 15:40
漂漂 阅读(1868)
评论(0) 编辑 收藏 引用 所属分类:
c#开发