且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我无法将现有的Windows窗体添加到我的项目中

更新时间:2023-02-16 23:24:32

v.2.0和更高版本中的每个表格都使用partial class功能跨越至少两个不同的文件.开发人员可以使用此原理添加更多文件.这些文件之一用于Designer生成的代码.如果需要在其他项目中移动现有文件,则需要全部移动它们.

我已经做过几次了;它总是对我有用.项目节点的结构可能会丢失(最初,自动生成的代码将作为另一个文件节点的子节点;但是将文件移入项目后,它们可能会显示为对等节点),但是1)即使在这种情况下,该项目在功能上有利于进一步开发,因此您可以忽略该问题; 2)您可以修复结构:使用一种形式创建一个简单的项目,学习这两个文件节点的语法,并在文本编辑器中手动编辑您的项目文件;要非常小心;在手术之前备份您的项目.

与上述第(2)项有关的简短建议:没有版本控制系统就无法工作. Subversion或Git或Bazaar等都是出色的可靠免费产品,带有完整的开源代码.

—SA
Each form in v.2.0 and later spans at least two different files, using partial class feature. The developer could add some more files using this principle. One of these files is used for Designer-generated code. If you need to move existing files in different project, you need to move them all.

I''ve done it several times; it always worked for me. The structure of the project nodes could be lost (originally, auto-generated code goes as a child node of the other file''s node; but after moving files into the project they may appear as peer nodes), but 1) even in this case the project is functionally good for further development, so you can ignore the problem; 2) you can fix the structure: create a simple project with one form, learn the syntax of these two file nodes and manually edit your project file in a text editor; be very careful; backup your project before this surgery.

A short advice related to the item (2) above: don''t work without Revision Control System. Subversion or Git or Bazaar, etc. are wonderful reliable free products with full Open Source code.

—SA