如何在当前项目中包含另一个项目的表单? [英] How do I include a form from another project in my current project?

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

问题描述

如何将另一个项目中的表单添加到现有项目中,并将其编译和链接而不必重命名命名空间等。

示例:

项目A具有CoolForm .h,CoolForm.cpp,CoolForm.resX

将这些文件添加到项目B(主要是将文件复制到该目录,将文件添加为现有文件,然后修改项目文件以将其视为来自而不是单个文件)

在项目B中看起来一切正常,甚至编译和链接。但是在运行时我点击在Proejct BI中启动CoolForm的按钮得到一个例外,需要嵌入ProjectA.CoolForm.resX或者为它添加组件作为对ProjectA的引用

我去了并修改了resX文件的属性以使用ProjectA而不是$(Rootnamespace),我知道得到ProjectA.CoolForm.resource文件,但是链接器因为在链接期间找不到ProjectB.CoolForm.resource文件而死掉。
br>必须有一些方法将项目包含在项目B中,而不必定期进入并按摩命名空间......当然,我这样做是为了避免在2个地方定期维护此表格。< br>
George


George P Botuwell,程序员

How do you add an Form from another project into your existing project and get it to compile and link without having to redo the namespaces, etc.

Example:

Project A has CoolForm.h,CoolForm.cpp,CoolForm.resX

Add those to Project B (essentially by copying the files over to that directory, adding the files as existing files, and then modifying the project file to see them as an from instead of individual files)

That all works fine in Project B it seems, even compiles and links.  But at run time when I go to click the button that launchs CoolForm in Proejct B I get an exception the ProjectA.CoolForm.resX needs to be embedded or the assemblys for it added as a reference to ProjectA

So I went and modified the resX file's properties to use ProjectA instead of $(Rootnamespace), I know get ProjectA.CoolForm.resource files, but then the linker dies because it can't find ProjectB.CoolForm.resource files during linking.

There's got to be some way to include the form in Project B without having to regularly go in and massage the Namespace...  Of course I'm doing this to try to avoid having to regularly maintain this Form in 2 places.

George


George P Botuwell, Programmer

推荐答案

我有几点要说,

I have a few things to say,


  1. 这个帖子应该在不同的论坛上。
  2. 我的工作不是很多听起来像WinForms,但它应该是sa我对所有项目类型。您应该尝试将ProjectA包含到ProjectB的解决方案中,然后在ProjectB的属性页面中,选择Common Properties选项卡,然后选择
    ,然后单击Add New Referance。在出现的窗口中单击ProjectA,然后单击"确定"。窗口将关闭,在属性页面中单击确定以保存更改。

就像我在第2号中说的那样,它可以工作,但我没有尝试过。所以,如果没有,请告诉我,我会尽力解决。

Like I said in No.2, it sould work but I havn't tried it. So if it doesn't, let me know and I will try to figure it out.

希望这对你有所帮助。


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

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