我尝试编写一个程序来在两个表单之间切换。我的策略是创建两种形式。代码如下:
Public Class Form1
Private Sub switch_Click(sender As Object, e As EventArgs) Handles switch.Click
Me.Visible = False
Form2.Show()
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
Me.Size = New System.Drawing.Size(500, 500)
End Sub
End Class
Public Class Form2
Private Sub Back_Click(sender As Object, e As EventArgs) Handles Back.Click
Me.Visible = False
Form1.Show()
End Sub
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles Me.Load
Me.Size = New System.Drawing.Size(500, 500)
End Sub
End Class
但是,当我这样做时,我可以看到form1消失的过程和form2的显示。 [抱歉英语,我可能会误用这里的单词]而且,两种形式的位置并不完全匹配。我能想到的一个策略是预先定义两个表单的位置(大小),这样当它们被加载时,它们将出现在完全相同的位置。但是,正如我在上面的代码中所示,情况并非如此。我想知道在表格之间顺利切换的策略是什么? 感谢