如何在 Visual Studio 6.0 或 Embedded VC 中将对话框资源从一个项目复制到另一个项目 (电动车)?
我有两个代码分支。 1 有一个对话框,而另一个没有,但由于政治原因,该对话框没有移到最新的分支中。 现在他们想要它......
那么是否可以将对话框从一个项目复制到另一个项目。 似乎有导出和导入功能,但它是灰色的。
I've got two branches of code. 1 has a dialog box that the other doesn't, but because of politics the dialog box wasn't moved into the newest branch. Now they want it in...
So is it possible to copy a dialog box from one project to another.
There apears to be an export and import feature however it's greyed out.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
.RC 文件是简单的文本文件。 您只需将 DIALOG 文本从一个 .RC 文件复制/粘贴到另一个 .RC 文件即可。 确保您也复制了相应的 RESOURCE.H 条目。
或者,您也可以打开两个 .RC 文件,然后只需将对话框从一个文件拖放到另一个文件即可。
.RC files are simple text files. You can simply copy/paste the DIALOG text from one .RC file to the other. Make sure that you copy the corresponding RESOURCE.H entries as well.
Alternatively, you might be able to open both .RC files and then simply drag-and-drop the dialog from one to the other.
Visual Studio 2010 - 2013 更新:
您仍然可以进行拖放和复制粘贴,但只能在项目/解决方案之外进行。
关闭解决方案,将两个 RC 作为文件打开,无需任何打开的解决方案,然后继续。 对于拖动,“按住 CTRL 键并将资源拖动到第二个 .rc 文件。例如,将 IDD_DIALOG1 从 Source1.rc 拖动到 Source2.rc。”
Microsoft - 如何复制资源
Update for Visual Studio 2010 - 2013:
You can still drag-drop and copy-paste, but only outside of your project / solution.
Close solution, open both RC as files without any open solution, and go. For drag, "Hold down the CTRL key and drag the resource to the second .rc file. For example, drag IDD_DIALOG1 from Source1.rc to Source2.rc."
Microsoft - How to Copy Resources
拖放操作在 Visual Studio 2010 中不起作用。编辑 .RC 文件确实有效,但要小心。 对我来说,对话框的 ID 显示为 *ID_etc*。 我复制了它并删除了*,它似乎解决了问题。
Drag and drop doesn't work in Visual Studio 2010. Editing the .RC file does work but be careful. For me the ID for the dialog showed up with *ID_etc*. I copied it and removed the *'s and it seemed to fix the problem.
我终于弄清楚如何将对话框从一个解决方案复制到另一个解决方案。
步骤:
I finally figure it out how to copy a Dialog from one solution to another.
Steps:
这只是为了向已接受的答案(由 Roger Lipscombe 提供)及其步骤添加一些视觉细节。
为了将对话框等资源从一个项目复制到另一个项目,可以遵循以下步骤。
请注意,此操作会更新resource.h 文件。 这是 Visual Studio 提供的极好的帮助。
必须确保resource.h 文件中不存在重复的资源ID。 在处理一些旧项目时,发现存在一些重复的资源 ID,必须手动更正。 看来这样的努力值得考虑否则所需的艰巨任务。
This is just to add some visual detail to the accepted answer (by Roger Lipscombe) along with its steps.
In order to copy a resource such as a Dialog from one project another project, below steps can be followed.
Please note that this operation would have updated the resource.h file. That is an excellent help by Visual Studio.
One will have to make sure that no duplicate resource IDs are present in the resource.h file. When working with some legacy projects, it is found that there came some duplicate resource Ids that had to be manually corrected. It looks like such an effort is worth considering the mammoth task required otherwise.