Timage transparenty on transparent form
Posted on 2006-11-02
I have successfully created a TImage with transparency using this code:
Image1.Picture.Bitmap.TransparentColor := Image1.Picture.Bitmap.Canvas.Pixels[50,300];
Image1.Picture.Bitmap.TransparentMode := tmFixed;
Image1.Transparent := true;
This works fine.
Secondy I need my form to be transparent, which is done using this code:
procedure TForm.FormCreate(Sender: TObject);
with FormProducts do
BorderStyle := bsNone;
hRgn := CreateRectRgn(0, 0, 0, 0);
for i := 0 to ControlCount - 1 do
with Controls[i].BoundsRect do
CombineRgn(hRgn, hRgn, CreateRectRgn(Left, Top, Right, Bottom), RGN_OR);
SetWindowRgn(handle, hRgn, True);
Which also works. The problems arise when these snippets are combined. The image doesn't show the graphics behind the form, but shows the color the form was before it became transparent. Any idea how to get around this problem?
My main task is to create a form which isn't triangular. I need some of the edges to be round and follow the shape of some images. If anyone has a different idea to do this it would also be most welcome.