Show a child form in the centre of Parent form in C#

后端 未结 19 1141
不思量自难忘°
不思量自难忘° 2020-11-28 08:21

I create a new form and call from the parent form as follows:

loginForm = new SubLogin();   
loginForm.Show();

I need to display the chi

19条回答
  •  长情又很酷
    2020-11-28 08:59

    You need this:

    Replace Me with this.parent, but you need to set parent before you show that form.

      Private Sub ÜberToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ÜberToolStripMenuItem.Click
    
            'About.StartPosition = FormStartPosition.Manual ' !!!!!
            About.Location = New Point(Me.Location.X + Me.Width / 2 - About.Width / 2, Me.Location.Y + Me.Height / 2 - About.Height / 2)
            About.Show()
        End Sub
    

提交回复
热议问题