MDI Parent Form - Background Image Stretching

Is there anyway to set an image as the background of an MDI parent form in VB.Net, and have it stretch to fill the window?  I haven't seen anything anywhere to do this.  I am able to create a picture box over the form surface, but the child controls are then hidden.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I used this code for the Form background image. Maybe it will work for MDI parent (Inever tried)

' Paint an image loaded from a file directly on the form.
' This example hooks into the form's Paint event using the
' Handles clause.
Private Sub PaintImageOnForm( _
    ByVal sender As Object, _
    ByVal e As System.Windows.Forms.PaintEventArgs) _
    Handles MyBase.Paint

    e.Graphics.DrawImage( _
         Image.FromFile("C:\windows\web\wallpaper\wind.jpg"), 2, 2)

End Sub
raiderjakkAuthor Commented:
Nope.... that doesn't seem to do it.... MDI forms are special cases it seems.  :-)

raiderjakkAuthor Commented:
Actually, I figured out how to do this.

You can't subclass the paint event to get the graphics context because the background image isn't part of the signature for that event.  

Instead, I invoke a procedure that scales the image after a resize or move that redraws the background.  

The other oddity is that you have to have to refresh the parent form from within the child, otherwise, the image takes the forefront.

I will post code and accept the answer when I have it handy.  :-)


Bob LearnedCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:


Please leave any comments here within the next seven days.


EE Cleanup Volunteer
PAQed, with points refunded (50)

E-E Admin

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.