I want to create a form, but just use it to keep an image. (Like a splash form)
To create a form like these I use these lines:
SetWindowLong(Handle, GWL_EXSTYLE, LexStyle or WS_EX_LAYERED);
UpdateLayeredWindow(Handle, 0, nil, @LBitmapSize, LBitmap.Canvas.Handle, 0,
@LBlendFunction, ULW_ALPHA);
This image is a PNG image with transparent layer.
The form must have a parent form or must have the behavior of a form that have it.
That is the problem, if I add some component on this form, this just doesn't show the component.
And if I set a parent form to it, this lose its transparency.
But I need to add components in this and I need to set a parent to the form.
Some one knows other way to do this?
Best Answer
You can try not set Parent property directly but use subclassing ...
Suppose TParentForm is parent form and TAlphaForm is form with image.
When creating TAlphaForm instance, pass instance of TParentForm as Owner parameter and change WndProc of owner form in constructor.
Next is example code for TAlphaForm:
Implementation:
For me solution works with this parent form code:
Implementation: