|
-
Jun 12th, 2006, 10:47 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] [2005] mdi bg
I am creating a program which has a main MDI parent. I want to have a cool background image as a background. But if I put a picutrebox on the MDI parent, it like leeks through all the MDI childs, causing it so I can't even see my MDI child forms. Is there a way to bypass this?
Last edited by 3dmaker; Jun 12th, 2006 at 11:20 PM.
Katya Chehova is best!
-
Jun 12th, 2006, 10:50 PM
#2
Re: [2005] mdi bg
The point of an MDI application is that the parent is an empty container waiting for child forms. I don't think you can set any kind of background inside of it unless you change your deisng. Perhaps use only 1 form and instead of child forms, use user controls.
-
Jun 12th, 2006, 10:59 PM
#3
Re: [2005] mdi bg
When you set the IsMdiContainer property of a form to true an MdiClient control is added to your form. This is the grey area that you can see and it is what hosts the child forms, not the parent form itself. You are not provided an explicit reference to this MdiClient control because you are not supposed to touch it. If you place a PictureBox on your form it doesn't "leak" through anything. It is physically sitting on top of the child forms in the z-order. If you call SendToBack on the PictureBox then it will drop to the bottom of the z-order and will be hidden behind the MdiClient. If you want to provide a background for the client area of the parent form then you need to get a reference to the MdiClient control, which can only be done at run time, e.g.
VB Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For Each ctl As Control In Me.Controls
If TypeOf ctl Is MdiClient Then
ctl.BackColor = Color.Red
Exit For
End If
Next
End Sub
-
Jun 12th, 2006, 11:20 PM
#4
Thread Starter
Hyperactive Member
Re: [2005] mdi bg
Thanks the code works...!
-
Jun 13th, 2006, 10:25 AM
#5
Re: [RESOLVED] [2005] mdi bg
Good info jmcilhinney. I never knew that.
I tried giving you rep but it still says I need to spread it around more... weird I've given a ton of it out too! Bah!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|