简体   繁体   English

在 Visual Studios 中关闭 rc 资源文件的编辑

[英]Close editing of rc resource files in Visual Studios

I'm new to rc files and I'm used to being able to close files in VS and be prompted to save or not save.我是 rc 文件的新手,我习惯于能够在 VS 中关闭文件并被提示保存或不保存。 This way I can quickly undo changes I've made to the file.这样我就可以快速撤消对文件所做的更改。 How do I get similar functionality for rc files?如何获得 rc 文件的类似功能? Thanks.谢谢。

You can't!你不能! This is just one of the many infuriating things about both RC files and VS.这只是关于 RC 文件和 VS 的众多令人愤怒的事情之一。

The only easy way I have found is to close the solution, discard the changes, and open the solution again.我发现的唯一简单方法是关闭解决方案,放弃更改,然后再次打开解决方案。

I've got into the habit of editing resource files in a text editor most of the time.我已经养成了大部分时间在文本编辑器中编辑资源文件的习惯。 That saves a lot of pain.这样可以省去很多痛苦。 I also use Git, so it's often quite easy to revert any unstaged changes or cherry-pick those that I want to keep.我也使用 Git,因此通常很容易恢复任何未暂存的更改或挑选我想要保留的更改。 The bonus is when I modify the resource this way, VS will detect it and prompt me to reload the file, discarding any changes.好处是当我以这种方式修改资源时,VS 会检测到它并提示我重新加载文件,丢弃任何更改。

I found one tricky workaround to do what you asked for without solution reloading.我找到了一种棘手的解决方法,可以在不重新加载解决方案的情况下完成您的要求。

  1. Ctrl + Shift + F to open find dialog. Ctrl + Shift + F打开查找对话框。
  2. In the "Find what" field, type any text which should preset in the resource-file (for example, ID of some control).在“查找内容”字段中,键入应在资源文件中预设的任何文本(例如,某些控件的 ID)。
  3. Along with other files, records corresponding to your resource-file should be appeared in search results.与其他文件一起,与您的资源文件对应的记录应出现在搜索结果中。
  4. Double-click on any of this records.双击任何此记录。 If the resource-file was opened (exactly as a resource file) at this stage, VS will inform you about this and ask you what to do: to close other editor or to leave all as it's.如果在此阶段打开了资源文件(完全作为资源文件),VS 会通知您并询问您该怎么做:关闭其他编辑器或保持原样。 The first option is our goal.第一个选项是我们的目标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM