Главная страница | назад





Article #16794: Dynamically drawing a transparent image

 Question and Answer Database

FAQ1794D.txt   Dynamically drawing a transparent image
Category   :VCL
Platform    :All
Product    :All 32 bit  

Question:
How do I use a TImageList component to dynamically draw a
transparent image?


Answer:
The following example demonstrates the dynamic creation of a
TImageList component used to draw a transparent bitmap.

Example:

procedure TForm1.Button1Click(Sender: TObject);
var
  bm : TBitmap;
  il : TImageList;
begin
  bm := TBitmap.Create;
  bm.LoadFromFile('C:\DownLoad\TEST.BMP');
  il := TImageList.CreateSize(bm.Width,
                              bm.Height);
  il.DrawingStyle := dsTransparent;
  il.Masked := true;
  il.AddMasked(bm, clRed);
  il.Draw(Form1.Canvas, 0, 0, 0);
  bm.Free;
  il.Free;
end;


7/16/98 4:31:28 PM
 

Last Modified: 01-SEP-99