开发者

Changing the layout order of vb.net controls

开发者 https://www.devze.com 2023-02-13 17:02 出处:网络
I dynamically add picture boxes to a vb.net form. However, when I add the new picture box, it 开发者_Python百科is always under/below/behind the picture boxes that I previously created. Is it possible

I dynamically add picture boxes to a vb.net form. However, when I add the new picture box, it 开发者_Python百科is always under/below/behind the picture boxes that I previously created. Is it possible to change it so that the newly created picture box would always be in front of the others?

Thanks


Just add this code to the part that creates the pictureboxes

PictureBox.BringToFront()


Dim mypic As PictureBox = New PictureBox
mypic.Height = 13
mypic.Width = 13
mypic.Left = 100
mypic.Top = 100
mypic.Visible = True
mypic.SizeMode = PictureBoxSizeMode.Normal
mypic.Parent = Me
mypic.Image = Image.FromFile("Path of the Image")
Me.Controls.Add(mypic)
mypic.bringtofront()
0

精彩评论

暂无评论...
验证码 换一张
取 消