Reputation: 178
I create a form (Form1) that I am using as a background form. I set its AlphaBlend property to True and set its AlphaBlendValue to 230, making the form transparent.
I then create a second, totally independent, form (Form2) with its AlphaBlend property to False (I even implicitly set this when creating the form). I then set Form1 as the parent window of Form2 (via Form2.Parent = Form1).
This makes the child window take on the parent windows AlphaBlend Properties which then cant be independently changed. I am unable to modify the Alpha properties on Form2 at all.
I require Form2 to be a child of Form1 but cant have the Alpha properties inherited.
Upvotes: 1
Views: 566
Reputation: 178
OK I have changed my source code to get fix the issue on the WS_EX_LAYERED Window form by adding two forms on the main app one of them is alphablend true with 200 value as a background and the second is normal as the front window while the main App is totally transparent with the property transparent color and here is the link of my first beta solution https://1drv.ms/u/s!Alu0WnpJr3ruhTB68XOMcpd3mB5u
Finally I have a little issue with the background form that can't be a container for any controls or even the hit test doesn't work on it.... I hope to accept my idea even has not complete yet....
Upvotes: 1
Reputation: 21033
Perhaps you can consider another approach: do not set the parent of the "embedded" form, but keep it separate. Instead handle message WM_WINDOWPOSCHANGING
of Form1
and set Form2
position relative to ClientOrigin
of Form1
:
type
TForm1 = class(TForm)
private
procedure WindowPosChanging(var Msg : TMessage); message WM_WINDOWPOSCHANGING;
public
end;
implementation
{$R *.dfm}
uses Unit2;
procedure TForm1.WindowPosChanging(var Msg: TMessage);
begin
if Assigned(Form2) then
begin
Form2.Left := ClientOrigin.X + 20;
Form2.Top := ClientOrigin.Y + 10;
end;
end;
Looking closely, one can see that the second form is lagging a pixel or so in following the movement of the first form, shouldn't bee too disturbing.
Upvotes: 1