如何在Visual Studio 2008中折叠选定的代码块? [英] How do I collapse selected chunks of code in Visual Studio 2008?

查看:1245
本文介绍了如何在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆