Posted on 1998-10-29
I have a control descended from TCustomControl. At certain times I want it to become transparent. To that end, I have added the following code (overridden)
procedure TcbImageBtn.CreateParams(var Params: TCreateParams);
Params.ExStyle:=Params.ExStyle or WS_EX_TRANSPARENT;
When the component is supposed to be transparent, I do nothing except call inherited in the Paint routine. When it is not transparent, I do a Canvas.Draw(0,0,Picture).
When the component first appears, it is transparent, and it works. It then goes to an opaque status, and paints the image OK. Then when it returns to transparent status, it becomes a black rectangle.
Any ideas anyone?