How to display a centered background image in the MDI area?

F

Frank

Hello.

does anybody knows, how to display a centered background image in the mdi
area of the MDI parent form?

I tried to set a picture box in the MDI area with dock state "Fill", but the
MDI childs are displayed behind this picture box. The second try was a
maximized MDI child without frame. This works but it was listed in the MDI
child list in the menu.

Thanks

Frank
 
G

Guest

Hi Frank

There are a few posts that illustrate how to do this on this group: Bob
Powell's website has an article with the general principle:
http://www.bobpowell.net/mdiback.htm

Essentially you need to get the MdiClient control and work with that. You
can set a BackgroundImage like this...(on an MDI Form). Centering will
require you to write event handlers for resizing and painting the control.

For Each c As Control In Me.Controls
If TypeOf c Is MdiClient Then
c.BackgroundImage = theImage
End If
Next

HTH

Nigel
 
B

Bob Powell [MVP]

Thanks to Nigel for pointing out the MDI article in Windows Forms Tips and
Tricks.

You will also find that the GDI+ FAQ has an article on determining the
best-fit for an image while maintaining the original aspect ratio. This will
help you to solve the other bit of the puzzle.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml
 
F

Frank

Hello Bob,

thanks for your answer. Nigel's MDI article solves my problem perfectly.

Thanks for your help.

Frank
 

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