Link to home
Start Free TrialLog in
Avatar of Chris Nillissen
Chris NillissenFlag for Australia

asked on

Child/Parent Form Transparency Problem

I have a parent form that is alphablended, but I dont want its child form to be transparent at all. The problem I am having is that Delphi seems to make the child form inherit the alphablending properties from its parent. I have tried all obvious things bu to no avail.

Under Visual Basic 6 it seems to work fine, but now that I am porting this application to Delphi this behavour is different.

Is there any way to stop this?
Avatar of Geert G
Geert G
Flag of Belgium image

look in the dfm code

it will start with inherited FormX

and properties you have changed will be listed

compare the dfm of the parent with the dfm of the child
to see differences

defaults are not saved, unless explicit indicated

property Opaque default False stored True;
Avatar of Chris Nillissen

ASKER

Sorry I am not creating an inhereted form. Let me rephrase the question a bit to make it clearer:

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 128, 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.ParentWindow = Form1.Handle).

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.
Form2.ParentWindow = Form1.Handle

have you tried this instead ?
Form2.Parent := Form1

Interesting my comment never came through yesterday

This is by design, you can't change it at least I have never come a cross a way of doing it. Even if you override the form, still won't work

@Geert
Form2.Parent := Form1
This makes no difference
no ?
then what does ?
You tell me
Yes I have tried Form2.Parent := Form1 and it has the same effect as Form2.ParentWindow = Form1.Handle.

It seems strange that this behavour cant be changed. Its fine in other languages just not Delphi.
There must be a way to do this?
ASKER CERTIFIED SOLUTION
Avatar of Ephraim Wangoya
Ephraim Wangoya
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial