By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,534 Members | 910 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,534 IT Pros & Developers. It's quick & easy.

MDI Child Windows Overlapped by control on Parent

P: n/a
Hello everyone.

I have an MDI form (parent) that has a number of controls on it. When I
display MDI child windows, the child windows appear behind the controls
that are on the parent window. How can make it so that the child window
are on top of the controls on the parent window.

Thanks in advance.

Diego

Apr 3 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hello, Diego,

I think that it is a bit unusual to put controls directly on the MDI
form. If you do they will always be on top, as you've noticed.

Is there some reason that you can't put your controls on a toolbar?

If you really must do something like this, the only possibility that I
can think of is to draw fake images of your controls on the MDIClient
and do all of your own processing of mouse and keyboard events to
simulate the behaviour of real controls.

To me, this sounds like far too much trouble, and it has the associated
risk that goes with the caveat in the documentation for the MDIClient
that says: "The MdiClient type supports the .NET Framework
infrastructure and is not intended to be used directly from your code."

Cheers,
Randy
diego wrote:
Hello everyone.

I have an MDI form (parent) that has a number of controls on it. When I
display MDI child windows, the child windows appear behind the controls
that are on the parent window. How can make it so that the child window
are on top of the controls on the parent window.

Thanks in advance.

Diego

Apr 3 '06 #2

P: n/a
I've put many controls on a MDI parent, not unusual at all. However you
should put them on a container which you dock. Then you should have no
problems whatsoever.

Example:

http://www.espital.net/studyui.htm
"diego" <di******@yahoo.com> wrote in message
news:11*********************@g10g2000cwb.googlegro ups.com...
Hello everyone.

I have an MDI form (parent) that has a number of controls on it. When I
display MDI child windows, the child windows appear behind the controls
that are on the parent window. How can make it so that the child window
are on top of the controls on the parent window.

Thanks in advance.

Diego

Apr 3 '06 #3

P: n/a
Hi Randy,

Thanks for your reply.

What I want to place on the MDI form is a Web browser control to
display a page from a pre-determined site. This page may contain
announcements, warnings, etc. for the users.

Is this possible?

Thanks in advance.

Deigo

Apr 4 '06 #4

P: n/a
Hello, Diego,

I don't think it is possible to do this directly. It would be easy to
put it onto some sort of a docked container control, but I guess this is
not what you want.

If the contents are for "display-only", and you do not need any active
controls on the MDI background you might be able to find a way to copy
the image of the Web page to the MDIClient.

I don't know offhand how you would get the image from the web page, but
if you can then you could do something like this:

Private WithEvents mFrame As MdiClient ' MDI Client window frame.

You will need to "find" the MDIClient. Maybe there are better ways, but
this has worked for me:

For Each ctlCurrent As Control In Me.Controls
If (TypeOf ctlCurrent Is MdiClient) Then
mFrame = DirectCast(ctlCurrent, MdiClient)
Exit For
End If
Next ctlCurrent

I have used this in the first pass of the MDI Form's Activate event, but
have recently learned that .Net 2005 provides a "Shown" event that may
be better for this.

Then, use the Paint event of the MDIClient to display the image of your
web page.

Private Sub MDIControl_Paint(ByVal sender As Object, _
ByVal e As PaintEventArgs) _
Handles mFrame.Paint
' Copy the image here using e.Graphics
. . .

End Sub

But again, don't forget the caveat that "The MdiClient ... is not
intended to be used directly from your code." And if you want to
simulate active controls on the MDI background, this will become much
more difficult. There might be better/easier ways to accomplish the
functionality that you want.

Good luck,
Randy
diego wrote:
Hi Randy,

Thanks for your reply.

What I want to place on the MDI form is a Web browser control to
display a page from a pre-determined site. This page may contain
announcements, warnings, etc. for the users.

Is this possible?

Thanks in advance.

Deigo

Apr 4 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.