如何在一个项目中将表单作为另一个项目中的子项 [英] How can I make a form in one project a child in another

查看:142
本文介绍了如何在一个项目中将表单作为另一个项目中的子项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在vb.net的一个单独项目中开发了一个带有启动表单的报告模块。之后我创建了一个带有midi父级的新vb.net win表单项目。我想打电话给现有的报告程序,让它作为一个孩子打开到neparent。



在VB6中,我有一些例程,可以让我设置父属性单独项目中的表格。



在vb.net中是否有类似内容?



我尝试了什么:



在VB6代码中我有;

I developed a reporting module with a startup form in a separate project in vb.net. I have since created a new vb.net win form project with a midi parent. I would like to call the existing report program and have it open as a child to the neparent.

In VB6 I had routines that would let me set the parent attribute in a form in a separate project.

Is there something similar in vb.net?

What I have tried:

In the VB6 code I have;

Public Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long





例程



routines

Public Function fun_ParentHwnd(Optional nHwnd As Long, Optional bClear As Boolean) As Long


    Dim n   As Long
    
    'Read registry setting for ParentHwnd from Parent form

    n = GetCUSetting("", "ParentHwnd", 0)

    fun_ParentHwnd = n
        
End Function
Sub MakeMeChild(nHwnd As Long)

    Dim nRet    As Long
    
    UBhWnd = fun_ParentHwnd
    
    nRet = SetParent(nHwnd, UBhWnd)
    
    UBhWnd = ubHandle

End Sub

推荐答案

您可以在当前项目中添加参考到其他项目;只需引用.exe或.dll(如果它是类库)。



(是的; .exe可以像.dll一样访问。因为访问的表单/窗口/类是公开的。
You can add a "reference" in your current project to the "other" project; just reference the .exe or the .dll (if it's a class library).

(Yes; an .exe can be accessed as you would a .dll as long as the accessed form / window / class is public).


这篇关于如何在一个项目中将表单作为另一个项目中的子项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆