Board index » delphi » 24 bit color .bmps in Resource File

24 bit color .bmps in Resource File

It seems that when compiling a .RC script with 24 bit .bmps with brcc32.exe,
it will fail.  If I save the .bmps to 256 color, it works fine... except I
loose the colors I need in the .bmp.  Similarily with when adding the RC
script to the project and compiling,  it will not work with 24 bit color
.bmps but works fine with 256 color.

Does anyone have a solution to getting 24 bit color .bmps into a Resource
File.

Regards

 

Re:24 bit color .bmps in Resource File


Alan,

Store the bitmap as RT_RCDATA and recover using TResourceStream.

var
  bmp:TBitmap;
  R  :TResourceStream;
begin
  R:=TResourceStream.Create(HInstance, 'MYBITMAP', RT_RCDATA );
  try
    bmp := TBitmap.Create;
    bmp.LoadFromStream(R);
    try
      {Do the business here}
    finally
      bmp.Free;
    end;
  finally
    R.Free;
  end;
end;

Bob
----
Sent using Virtual Access 5.01 - download your freeware copy now
http://www.atlantic-coast.com/downloads/vasetup.exe

Other Threads