Results 1 to 5 of 5

Thread: [RESOLVED] [2005] mdi bg

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2005
    Posts
    331

    Resolved [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!

  2. #2
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    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.
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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:
    1. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.     For Each ctl As Control In Me.Controls
    3.         If TypeOf ctl Is MdiClient Then
    4.             ctl.BackColor = Color.Red
    5.             Exit For
    6.         End If
    7.     Next
    8. End Sub
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2005
    Posts
    331

    Re: [2005] mdi bg

    Thanks the code works...!
    Katya Chehova is best!

  5. #5
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    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!
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width