Results 1 to 5 of 5

Thread: [RESOLVED] Moving one PictureBox on top of another

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2009
    Posts
    83

    Resolved [RESOLVED] Moving one PictureBox on top of another

    I load three PictureBoxes (Win1, Win2 and Win3) onto one form.
    Win1 is large and the other two are small.
    I can then draw on Win1.
    I can then use .TOP, .HEIGHT, .BOTTOM and .WIDTH to place Win2 on top of Win1 and print on it.
    I can then use .TOP, .HEIGHT, .BOTTOM and .WIDTH to move Win2 back to it's original place and size.
    I can then use .TOP, .HEIGHT, .BOTTOM and .WIDTH to place Win3 on top of Win1 and draw and print on it.
    Next I would like to place Win2 on top of Win3 and again print on it.
    But, when I use .TOP, .HEIGHT, .BOTTOM and .WIDTH to place Win2 on top of Win3 I can't see it.
    It is again on top of Win2 and I have to move Win3 before I can see it.

    How can I see Win2 without moving Win3?

  2. #2
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    Re: Moving one PictureBox on top of another

    Jerry

    One quick way might be ZOrder, as in

    Code:
    Win2.ZOrder 0
    If that doesn't do the trick, perhaps you could post some code and a screenshot

    Spoo

  3. #3
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    Re: Moving one PictureBox on top of another

    Jerry

    This sequence seems to confirm my thoughts

    Code:
    Sub Command2_click()
            nnJerry = nnJerry + 1
            Select Case nnJerry
                Case 1
                    With Win2
                        .Left = 1000
                        .Top = 1200
                        .Height = 1500
                    End With
                Case 2
                    With Win2
                        .Left = 3000
                        .Top = 1000
                        .Height = 500
                    End With
                Case 3
                    With Win3
                        .Left = 1000
                        .Top = 1200
                        .Height = 1500
                    End With
                Case 4
                    With Win2
                        .Left = 900
                        .Top = 1200
                        .Height = 1000
                    End With
                Case 5
                    With Win2
                        .ZOrder 0
                    End With
            End Select
    End Sub
    0. Initial
    Name:  Jerry0.png
Views: 327
Size:  2.6 KB

    1. Move Win2
    Name:  Jerry1.png
Views: 336
Size:  2.4 KB

    2. Move Win2 back
    Name:  Jerry0.png
Views: 327
Size:  2.6 KB

    3. Move Win3
    Name:  Jerry3.png
Views: 321
Size:  2.4 KB

    4. Move Win2 .. without ZOrder .. can't see it
    .. well, can't see most of it .. it appears to be "behind" Win3
    Name:  Jerry4.png
Views: 342
Size:  2.2 KB

    5. Set ZOrder on Win2 .. now can see all of it
    Name:  Jerry5.png
Views: 249
Size:  2.2 KB

    HTH

    Spoo
    Last edited by Spooman; Oct 30th, 2017 at 10:13 AM. Reason: steps 4,5 .. move Win2 left extra 100 for demo purposes

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jan 2009
    Posts
    83

    Resolved Re: Moving one PictureBox on top of another

    Spoo

    That solution did what I wanted. Thank You.

    Jerry900
    Last edited by Jerry900; Oct 30th, 2017 at 12:53 PM. Reason: Resolved

  5. #5
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    Re: [RESOLVED] Moving one PictureBox on top of another

    Jerry

    Glad to hear

    Spoo

Tags for this Thread

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