vb.net 一个窗体在另一个窗体的容器内显示

    Private Declare Function SetParent Lib "user32" Alias "SetParent" (ByVal hWndChild As IntPtr _
                                                                   , ByVal hWndNewParent As IntPtr) As Integer
    Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Integer, ByVal x As Integer, ByVal y _
                                                      As Integer, ByVal nWidth As Integer, ByVal nHeight _
                                                      As Integer, ByVal bRepaint As Integer) As Integer

    Public Shared mobjOpenForm As Form

    Public Shared Sub DisplayFrm(ByVal frm As Form)

        Try
            mobjOpenForm = frm
            SetParent(mobjOpenForm.Handle, FrmMain.PanDetail.Handle)
            mobjOpenForm.Visible = True
            'mobjOpenForm.WindowState = FormWindowState.Maximized
            'MoveWindow(mobjOpenForm.Handle.ToInt32, 0, 0, mobjOpenForm.Width, mobjOpenForm.Height, 1)

        Catch ex As Exception

        End Try

    End Sub

    Public Shared Sub CloseFrm()

        Try
            mobjOpenForm.Close()

        Catch ex As Exception

        End Try

    End Sub

你可能感兴趣的:(exception,function,user,Integer,VB.NET)