Thread View: borland.public.delphi.language.delphi.dotnet
3 messages
3 total messages
Started by Stephen Boyd
Tue, 17 Jun 2008 17:34
.RC files
Author: Stephen Boyd
Date: Tue, 17 Jun 2008 17:34
Date: Tue, 17 Jun 2008 17:34
32 lines
1952 bytes
1952 bytes
The component suite that I am porting to VCL.Net includes a .RC file,
which contains a number of bitmaps, using the {$R} directive. This all
seems to compile fine, but I can't figure out how to retrieve the bitmap
resources into the .Net application.
TBitmap.LoadFromResourceName(instance: HInstance; name: String) is
deprecated and TBitmap.LoadFromResourceName(name: String; base: String;
assembly: Assembly) can't seem to find the bitmaps. The code looks like
this:
{$R ESBASE.rc}
bmp := TBitmap.Create;
bmp.LoadFromResourceName('bmpname', 'ESBASE',
Assembly.GetExecutingAssembly);
This throws an exception telling me that ESBASE.resources in not
included in the assembly.
This all raises a few questions:
Can this be made to work using RC files?
If not, is there a tool that will convert the RC file to a .resources or
.resx file?
If no tool, then it would appear as though I a faced with writing a
small Win32 program to load the bitmap resources and save them as .BMP
files and then writing a small .Net program to load the .BMP files and
save them to a .resources file.
Any other options???
Re: .RC files
Author: David Wilcockson
Date: Wed, 18 Jun 2008 12:46
Date: Wed, 18 Jun 2008 12:46
15 lines
1414 bytes
1414 bytes
> Any other options???
var
bmpStream: System.IO.Stream;
bmp: System.Drawing.Bitmap;
begin
bmpStream := self.GetType.Assembly.GetManifestResourceStream('aaa.bmp');
// self - the current form
bmp := Bitmap.Create(bmpStream);
image1.Picture.Bitmap.LoadFromBitmap(bmp);
end;
David
Re: .RC files
Author: Stephen Boyd
Date: Wed, 18 Jun 2008 12:49
Date: Wed, 18 Jun 2008 12:49
18 lines
1396 bytes
1396 bytes
David Wilcockson wrote:
>
>> Any other options???
>
>
> var
> bmpStream: System.IO.Stream;
> bmp: System.Drawing.Bitmap;
> begin
> bmpStream := self.GetType.Assembly.GetManifestResourceStream('aaa.bmp');
> // self - the current form
> bmp := Bitmap.Create(bmpStream);
> image1.Picture.Bitmap.LoadFromBitmap(bmp);
> end;
>
> David
>
Thank you
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