Search Options
close
Search the following clips:
All Clips
news
science
politics
food
economy
art
technology
health
internet
religion
psychology
Sign Up
Install
Learn More
Login
C#中如何使用资源文件
neoit
follow
0
9-28-2008 4:10 AM
459 views
tags:
c#
,
.netr
Add a Comment
Login
to Comment. Not a member yet?
Sign up
Today's Top Clips
Polar Bear Populations Have Risen
WHY
Growing old
Amazing Colorful Sunset Photography
Ooops: is the 'G-spot' a myth?
Bats that sleep heads-up
Baby, it's cold outside
There will be blood
3 reasons to get a pet
National Geographic's Top Ten Space Pictures of 2009
visit the
Top Clips page
View the Top Clips from
September 28, 2008
Embed This Clip In Your Site...
<div style="margin: 12px 0px; font-family: arial; color: #333333; background: #ffffff; border: solid 4px #e5e5e5; width: 100%; clear: left;"><div class="CM_CTB_Content_Wrap" style="margin: 0px; padding: 0px;background-color: #ffffff;"><div style="border-bottom: solid 1px #dcdcdc; white-space: nowrap; margin-bottom: 8px; background-color: #eeeeee ;background-image: url(http://clipmarks.com/images/source-bg.gif); background-repeat: repeat-x; height: 24px; line-height: 24px; vertical-align: middle; padding-bottom: 4px; color: #666666; font-size: 10px;" ><a href="http://clipmarks.com/clip-to-blog/" title="see clips that are hot right now"><img src="http://content.clipmarks.com/blog_embed/163cf09d-a610-4d1a-b2e7-4e3e2198aa88/03643073-E45A-4D15-AD56-F2A57672A62B/" alt="" width="19" height="19" border="0" style="vertical-align: middle; margin: 0px 4px; display: inline; border: none; float:none;" /></a>clipped from <a title="http://www.cnblogs.com/skycharles/articles/325861.html" href="http://www.cnblogs.com/skycharles/articles/325861.html" style="font-size: 11px;">www.cnblogs.com</a></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://www.cnblogs.com/skycharles/articles/325861.html"><DIV class="postTitle"><A href="http://www.cnblogs.com/skycharles/articles/325861.html" class="postTitle2" id="AjaxHolder_ctl01_TitleUrl">C#中如何使用资源文件</A> </DIV> <P> 在C#中可以使用. Resources文件来保存各种类型的文件。下面我就举例说明如何创建和使用资源文件。首先是创造一个资源文件</p> <P>System.Resources.ResourceWriter myResource = new System.Resources.ResourceWriter("you.resources");</p> <P>myResource.AddResource("yangming", Image.FromFile("F:\\ym.jpg"));//添加F:\\ym.jpg到资源文件里去</p> <P>myResource.Generate();//创建资源文件</p> <P>myResource.Close();</p> <P>运行上边的代码就会在磁盘上出现you.resources文件,资源文件就这样被创建好了。并添加了图片到资源文件里。下边是如何使用资源文件里的资源</p> <P>下边的例子是把资源文件里的图片当作按扭的图片</p> <P><BR />System.Resources.ResourceManager rm = new System.Resources.ResourceManager("resources.you", System.Reflection.Assembly.GetExecutingAssembly());//这里的resources.you是因为工程的名字叫resources 而资源文件的名字叫you.resources。</p> <P>this.button3.Image = (Image)rm.GetObject("yangming");//这里的yangming是在资源文件中图片\ym.jpg被命名为yangming。</P></blockquote></div><div style="margin: 0px 6px 6px 4px;"><table style="font-size: 11px;border-spacing: 0px;padding: 0px;" cellpadding="0" cellspacing="0" width="100%"><tr><td style="background:transparent;border-width:0px;padding:0px;"> </td><td align="right" style="background:transparent;border-width:0px;padding:0px;width:107px" width="107"><a href="http://clipmarks.com/share/03643073-E45A-4D15-AD56-F2A57672A62B/blog/" title="blog or email this clip"><img src="http://content8.clipmarks.com/images/c2b-foot.png" border="0" alt="blog it" width="107" height="17" style="border-width:0px;padding:0px;margin:0px;" /></a></td></tr></table></div></div>
New from the makers of Clipmarks:
Amplify.com - Don't just share the news...Amplify it!
Clipmarks
Home
New Clips
Top Clips
Dashboard
Popular Topics
News
Life
Science
Technology
Entertainment
Get Started
Sign Up
Install Clipping Tool
How Clipping Works
Clip-to-Blog™
ClipSearch
Tools and Resources
FAQ
ClipWeek
Top Clippers
Top Tags
Site Map
About Clipmarks
About Us
Contact
Copyright
Privacy
EULA
OK