[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 228
  • Last Modified:

Image boxes (send to back, bring to front, etc)

I have two image boxes on a form. Both have '0' in the index property. One of the boxes is behind the other (by this I mean I have right clicked on it and clicked 'send to back' at design time). At runtime, I load new instances of both image boxes, but the instances of the box at the front are behind those of the other. Why is this? Can the order be changed at run time. The new image boxes of the 'in front' variety are created last.
0
mi5
Asked:
mi5
  • 2
  • 2
1 Solution
 
KDivadCommented:
Create the "behind" ones first.

Image1.ZOrder 0
Or
Image1.ZOrder
will bring the control to the front.
Image1.ZOrder 1
will send the control to the back.
I may have those values backwards, but in any case, you may want to look up "ZOrder" in the help file.

Later,
0
 
Erick37Commented:
Use the Zorder method to bring a control to front:

Private Sub Form_Load()
    picFront(0).ZOrder 0 'bring to front
    'Load 2 new boxes and make visible
    Load picFront(1)
    Load picBack(1)
    picFront(1).Visible = True
    picBack(1).Visible = True
    'Reposition the pic boxes
    picFront(1).Move picFront(0).Left, 0
    picBack(1).Move picBack(0).Left, 0
    'Bring this one to front
    picFront(1).ZOrder 0
End Sub
0
 
Erick37Commented:
Sorry KDivad, didn't see your comment while posting...
0
 
KDivadCommented:
Erick37, not a problem.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now