Results 1 to 6 of 6

Thread: Setting the Order

  1. #1

    Thread Starter
    Member
    Join Date
    May 2004
    Posts
    36

    Setting the Order

    OK this is what i've got:

    I have a MdiParent with a PictureBox in it and when I call a form from the main menu it shows up behing the picture box. How can i fix this?

    Thanks in advance

    Brad Nichols

  2. #2
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682
    have you tried

    PictureBox1.SendToBack()

    ?
    I don't live here any more.

  3. #3

    Thread Starter
    Member
    Join Date
    May 2004
    Posts
    36
    That doesn't work on a MDIParent.

    Any other suggestions?

    Thanks

    Brad Nichols

  4. #4
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Hi.

    You can't do that. Object placed directly on an MDIParent will always be in front of the MDIChildren.

    Why do you want to do this anyway?

    If you just want to display an image, you would have to find the MDIClient area of the main form. Then you can add a handler to the paint event, and draw the image yourself.

    VB Code:
    1. 'Put this in form load
    2. Dim o As Object
    3. For Each o in Me.Controls
    4.   If TypeOf (o) Is MDIClient Then
    5.     AddHandler o.Paint,AddressOf MyPaintEvent
    6.     Exit For
    7.   End If
    8. Next
    9.  
    10. 'Create a sub like this
    11. Private Sub MyPaintEvent(Byval sender As Object, Byval e as PaintEventArgs)
    12. e.Graphics.DrawImage(MyImage,0,0)
    13. End Sub

    I hope this helps you. If not, sorry.
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

  5. #5

    Thread Starter
    Member
    Join Date
    May 2004
    Posts
    36
    The reason for doing this is that I am writing a program for a company and the MDIParent is what is going to be shown most of the time. So I need to find a way that I can place objects on the MDIParent and the child forms display in front of it.

    Any help on this would be GREATLY appreciated.

    Brad Nichols

  6. #6
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Hi.

    I'm really sorry, but I just don't believe that can be done. At least not without some heavy API coding.

    I'm sorry I can't help you more.

    Good Luck on your quest.
    Please post the result, should you find it.
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

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