Child form windows

S

Steve Marsden

Hi

In WIN32 if you create a top level main window and then create a child
window which is a child of the main window, the child window moves with the
main window, cannot be moved out of the main window and cannot be activated
by clicking on it (the main parent window is activated).

I want this same behaviour with Windows Forms in C++ but cannot achieve it.

I have tried creating two windows forms and then setting the parent of the
second form to the first form with child->parent=mainform but the second
window just acts like a top level window.

How do I make one windows form a true child of another windows form.

Thanks

Steve
 
S

Steve Marsden

I thought I had solved this when I found the Owner property but this doesn't
seem to work either
 
H

Herfried K. Wagner [MVP]

Steve Marsden said:
How do I make one windows form a true child of another windows form.

Set its 'TopLevel' property to 'FALSE' and add it to the form's 'Controls'
collection.
 
S

Steve Marsden

Thank you. That worked perfectly.

Herfried K. Wagner said:
Set its 'TopLevel' property to 'FALSE' and add it to the form's 'Controls'
collection.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top