Thread View: borland.public.csharpbuilder.ide.general
2 messages
2 total messages
Started by Jeff
Mon, 11 Apr 2005 14:41
Embedded Resources
Author: Jeff
Date: Mon, 11 Apr 2005 14:41
Date: Mon, 11 Apr 2005 14:41
10 lines
1823 bytes
1823 bytes
Hi, I'm trying to use an embedded bitmap with C#Builder. I used a example program called ResXGen that came with the .NET SDK to create a .resx file from my bitmap (named FontStyleButtons.bmp). ResXGen takes a image file and the desired name for your resource (i used FontStyleButtons) and creates a .resx file. So I added this .resx file (named resfile.resx) to my project. When I build the project (the project name is Project) the file Project.resfile.resources is created in the directory containing resfile.resx. I used another program called ResEditor (this came with the .NET SDK) to examine the Project.resfile.resources file and this program indicated that the file contains the correct bitmap resource. The problem is that I can't seem to access the bitmap resource using the Bitmap constructor Bitmap(System.Type type, string resource). I get an exception of class System.ArguementException. What should the 2nd agruemennt to this constructor be? By the way I'm trying to run the examples from Charles Petzold's book "Programming Microsoft Windows With C#".
Re: Embedded Resources
Author: Joanna Carter (TeamB)
Date: Mon, 11 Apr 2005 14:06
Date: Mon, 11 Apr 2005 14:06
36 lines
2517 bytes
2517 bytes
"Jeff" <jeshort2@vt.edu> a οΏ½crit dans le message de news: 425a7e87$1@newsgroups.borland.com... > I used a example program called ResXGen that came with the .NET SDK to create a .resx file from my bitmap (named FontStyleButtons.bmp). ResXGen takes a image file and the desired name for your resource (i used FontStyleButtons) and creates a .resx file. So I added this .resx file (named resfile.resx) to my project. When I build the project (the project name is Project) the file Project.resfile.resources is created in the directory containing resfile.resx. I used another program called ResEditor (this came with the .NET SDK) to examine the Project.resfile.resources file and this program indicated that the file contains the correct bitmap resource. > > The problem is that I can't seem to access the bitmap resource using the Bitmap constructor Bitmap(System.Type type, string resource). I get an exception of class System.ArguementException. What should the 2nd agruemennt to this constructor be? I have not tried this in Delphi 2005 yet, but in VS2005, there should also be a .CS file created for the resource and placed in the properties foder of the current project. Inside this folder, you should find a your.name.space.Resources.cs file. This contains a class of static (class) methods, one for each resource. For string resources, I use Resources.sName, Resources.sAge, etc; so you should try Resources.YourBitmapResourcename for the second parameter. Joanna -- Joanna Carter (TeamB) Consultant Software Engineer TeamBUG support for UK-BUG TeamMM support for ModelMaker
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads