Bob
Sat Jul 16 04:29:48 CDT 2005
Resources come in two flavours. Either stored in a resx file or just added
to the solution and set as "embedded resource" in the build action
properties.
For your application it's probably just as easy to do the latter.
Add a resource to the solution, change the build action setting, retrieve it
useing the following:
Image.FromStream(me.GetType().Assembly.GetManifestResourceStream("myapp.Bitmap1.bmp"))
Note that the actual name you use depends upon the root namespace, whether
the resource is in a folder and other factors. If you can't deduce the fully
qualified name to use from your solution structure and namespace etc you can
put a bit of debug code in to help you. This can be removed later but it
lists all the resources for you so you can pick up the right one:
Dim resname As String
For Each resname in me.GetType().Assembly.GetManifestResourceNames
System.Disagnostics.Trace.WriteLine(resname)
Next
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"Paul Cheetham" <PAC.News@dsl.pipex.com> wrote in message
news:ex9G9pYiFHA.2484@TK2MSFTNGP15.phx.gbl...
> Thanks Bob.
>
> I'm not sure how to edit the resources in a .net project though. (Mine is
> in VB.Net) - Good old fashioned Win32 apps were fine, but does VS.Net have
> a resource editor?
>
> Thankyou.
>
> Paul
>
>
> Bob Powell [MVP] wrote:
>> You can embed one copy of the button and then get that from the resources
>> using GetManifestResourceStream.
>>