你如何将现有的形式添加到一个新的项目? [英] How do you add an existing form to a new project?
问题描述
我从来没有能够成功添加一个新的表格
文件作为现有文件到新的项目。我读了您添加只是* .cs文件一个博客,依赖进来。好了,我想这和文件做了dragin和* .designer和* .resx文件关联。但是,窗体图标不显示。相反,文件看起来像一个正常的* cs文件的图像。而且,当我双击该文件,我得到后面的代码,而不是形式的对象。
I have never been able to successfully add a new Form
file as an existing file to a new project. I read on a blog that you add just the *.cs file and the dependencies come in. Well, I tried this and the file did dragin and associate the *.designer and *.resx files. But, the Form icon does not display. Instead, the file looks like a normal *.cs file image. And, when I double click the file I get the code behind instead of the form object.
是否可以添加现有表单无需重新创建它们?
Is it possible to add existing Forms without recreating them?
推荐答案
一些研究之后,我发现了问题的根源。这是正确的,所有的人都有导入是 * CS
文件。需要说明的在于项目类型。如果在一个类库项目的工作,另一个步骤必须执行。
After some more research I discovered the source of the issue. It is correct that all one has to import is the *.cs
file. The caveat lies in the project type. If working in a Class Library project, another step must be performed.
- 添加到
System.Windows参考。 Forms.dll
和System.Drawing中
。 - 导入
*。CS
文件
- Add a reference to
System.Windows.Forms.dll
andSystem.Drawing
. - Import the
*.cs
file
注:
一个。之后,我执行了这些步骤,然后尝试打开该文件中的文件只能正确识别。突然VS唤醒并固定文件。
B的步骤无关紧要订单。如果您已经导入*的.cs文件,刚修好的引用。
C.如果一个人缺少其他参考资料(EG的DevExpress或其他第三方控制进口),将*的.cs文件将无法正常显示直到这个已经解决了。
A. The files are only properly recognized after I performed these steps and then tried to open the file. Suddenly VS "wakes up" and fixes the files.
B. Order of the steps does not matter. If you already imported *.cs files, just fix the references.
C. If one is missing other references (E.G. DevExpress or other 3rd party Control imports), the *.cs files will not display properly until this has been resolved.
这篇关于你如何将现有的形式添加到一个新的项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!