怎么设置label的属性让它始终处于pictruebox控件的正下方啊?
发布网友
发布时间:2024-10-23 23:23
我来回答
共1个回答
热心网友
时间:2024-11-15 13:12
Label的AutoSize属性最好设置为True,可以把Label放在任何位置,代码如下:
Private Sub Form_Load()
Label1.Top = Picture1.Top + Picture1.Height
Label1.Left = Picture1.Left + (Picture1.Width - Label1.Width) / 2
End Sub
上面是VB6的,看你的截图,应该是VB.NET,下面代码适用于VB.NET:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Location = New Point(PictureBox1.Location.X + (PictureBox1.Size.Width - Label1.Size.Width) / 2, _
PictureBox1.Location.Y + PictureBox1.Size.Height)
End Sub