如何在Visual Studio 2008中折叠选定的代码块? [英] How do I collapse selected chunks of code in Visual Studio 2008?
问题描述
在Visual Studio 2008中:是否有一种方法可以自定义地折叠代码,类似于我可以自动折叠大量的注释?
In Visual Studio 2008: Is there a way for me to customly collapse bits of code similar to like how I can automatically collapse chunks of comments?
推荐答案
根据需要,您的代码段必须是一个块:
Your piece of code needs to be a block surrounded by, as desired:
- 大括号 $在C#中的b $ b
-
#region
和#endregion
- C / C ++中的
#pragma region
和#pragma endregion
- braces
#region
and#endregion
in C##pragma region
and#pragma endregion
in C/C++
如果您无法折叠语句块,则需要启用此功能:
If you can't collapse statement blocks, you need to enable this feature :
工具 - >选项 - >文本编辑器 - > C / C ++ - > Formatting - >检查outlining中的一切
Tools -> Options -> Text Editor -> C/C++ -> Formatting -> check everything in "outlining"
(在Visual Studio 2013中它的工具 - >选项 - >文本编辑器 - > C / > View)
(In Visual Studio 2013 it's Tools -> Options -> Text Editor -> C/C++ -> View)
然后,重新打开源文件以重新加载大纲。
Then, reopen the source file to reload outlining.
这篇关于如何在Visual Studio 2008中折叠选定的代码块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!