Board index » delphi » Image Bitmap Question/Concern

Image Bitmap Question/Concern

My goal: I have an ImageList and I have an Image control.
In my program I would like to populate the Image control with a particular
imageindex of the ImageList.

Is there a direct of way of doing this?

Here's what I'm doing:
I have a 32x32 bitmap.  It has a Fuchsia background, a black square (16x16
centered), and the square is filled with white.  I put this image in as
index 0 in my ImageList.

So Fuchsia should be my Transparency color.

The Image control has all the default properties, except Autosize is TRUE,
and Transparent is True.

I use the following code:
    procedure TForm1.FormCreate(Sender: TObject);
    var
       bmpImage : TBitmap;
    begin
       bmpImage := TBitmap.Create;
       ImageList1.GetBitmap(0, bmpImage);
       Image1.Picture.Bitmap := bmpImage;
       bmpImage.Free;
    end;

This code works.  EXCEPT, any where the Bitmap is WHITE is transparent, not
just the FUCHSIA.  Both FUCHSIA and WHITE areas become transparent.

Can anyone explain this behavior and suggest a work around?  Or perhaps any
easier way to get to my goal?

Thanks for your help,
Brian Simmons
bsimm...@centrasoft.com
http://www.centrasoft.com

 

Re:Image Bitmap Question/Concern


You should check that the transparent of the image is set to false and the
image list passes the bitmap to your variable with the fushia turned white to
be transparent then the images reads the white in the top left corner and turns
all white transparent.

  If this is not the case try not assigning the bitmap but drawing it to the
surface or copyrect it to the surface.

--
 Mark Zwicker
 Computer Programmer
 Adventus INC.
 m...@adventus.com

Other Threads