我已经创建了一个表单。我在上面放了两个面板,分别是"Panel1"one_answers"Panel2"。我在Panel2里放了一个按钮。
然后我在表单中添加了另一个按钮,即"Button2"。
点击"Button2"执行以下代码:
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.Panel2.Parent = Me.Panel1
' Me.Panel1.Location = New Point(0, 0) this does not work either
End Sub
当我点击"Button2"时,"Panel2"就消失了。我希望"Panel2"被放在"Panel1"中,但是它没有显示在那里。
有人知道我做错了什么吗?
谢谢你的帮助!
你需要设置另一个面板的位置:
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.Panel2.Parent = Me.Panel1
Me.Panel2.Location = new point(0,0)
End Sub