4
I would like to open a form inside a panel, but when it opens, it is always the same size and in the same place regardless of the size of the form or the location.
Dim rv As New formRV
        rv.link = lvPasta.SelectedItems(0).ImageKey
        rv.FormBorderStyle = FormBorderStyle.None
        rv.Dock = DockStyle.Fill
        rv.TopLevel = False
        Dim p As New Panel
        With p
            Size = New Size(Me.Width, Me.Height)
            Location = New Point(Me.Location.X, Me.Location.Y)
        End With
        Me.Controls.Add(p)
        p.BringToFront()
        p.Controls.Add(rv)
        p.Show()
        rv.Show()
Edit:
Besides the panel i tried to just create the new form and display it, hiding the old form, but I had the screen problem "blink" while the form change (main form some - piece of windows - new form appears) and the buttons so that when the new form was closed by "X" (where a program normally closes) the first form was closed, but when you click another button to "go back" it closed form2 but not the first form.
Dim rv As New formRodaVideo
        rv.linkvideo = lvPasta.SelectedItems(0).ImageKey
        rv.FormBorderStyle = FormBorderStyle.Sizable
        rv.TopLevel = True
        rv.Width = Me.Width
        rv.Height = Me.Height
        rv.Location = Me.Location
        rv.WindowState = FormWindowState.Normal
        rv.StartPosition = FormStartPosition.WindowsDefaultBounds
        rv.Show()
        Me.Hide()
						
Hi @Lucas. What’s your idea with this? What do you want to do?
– João Martins
I have the main form and when I press a button on it, I need to call a second form, so that, the second form, is opened in the same place with the same size as the first form and keeping the first form hidden until the second form is closed. And right after the second form is closed I would need.
– Lucas Pedro