Load a picture box with an image. Then, load an overlapping picture box and its image goes on top nicely. But, when I load a third picture box, it goes in between the first and the second. What determines priorities and how can I overlap several picture boxes with the last being on top? thanks, hope this is not trivial, Bill

The "SetChildIndex" is the key.
Check out this example:

Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
		'create panel
		Dim imagePanel As New Panel With {.Width = 500, .Height = 500}
		Me.Controls.Add(imagePanel)
		'create images
		Dim pictures() As String = IO.Directory.GetFiles("C:\Users\Public\Pictures\Sample Pictures")
		Dim x As Integer = 1
		For Each pic In pictures
			Dim img As New PictureBox With {.Height = 100, .Width = 100, .Location = New Point(40 * x, 40 * x), .ImageLocation = pic, .Name = "pic" & x}
			AddHandler img.MouseHover, AddressOf Image_MouseHover
			imagePanel.Controls.Add(img)
			imagePanel.Controls.SetChildIndex(img, imagePanel.Controls.Count - x)
			x += 1
		Next
	End Sub

	Private Sub Image_MouseHover(sender As Object, e As EventArgs)
		Debug.WriteLine(CType(sender, PictureBox).Name)
	End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.