πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.csharpbuilder.ide.general
Article #28

Re: Embedded Resources

#28
From: Joanna Carter (TeamB)
Date: Mon, 11 Apr 2005 14:06
36 lines
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
Technical Details
Message-ID: <425a8475$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <425a7e87$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 165859,7f4f6ce4d2a85945
X-Google-Attributes: gid165859,public
X-Google-Language: ENGLISH,ASCII
From: "Joanna Carter \(TeamB\)" <joanna@nospam.co.uk>
Newsgroups: borland.public.csharpbuilder.ide.general
References: <425a7e87$1@newsgroups.borland.com>
Subject: Re: Embedded Resources
Date: Mon, 11 Apr 2005 15:06:18 +0100
Lines: 38
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 82.69.239.102
Message-ID: <425a8475$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1113228405 82.69.239.102 (11 Apr 2005 07:06:45 -0800)
X-Authenticated-User: jcarter
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail