Visual Studio C ++多行注释 [英] Visual Studio C++ Multiline comments

查看:495
本文介绍了Visual Studio C ++多行注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在VS C ++代码中,如果我未选择任何内容或未选择整行并按注释选择(Ctrl + K + Ctrl + C),则它将用//

In VS C++ code, if i haven't selected anything or full line selected and press comment selection (Ctrl+K + Ctrl+C) then it will comment the whole line with //

int x = 5;

按Ctrl + K + Ctrl + C后未选择任何内容或未选择整行。

After Pressing Ctrl+K + Ctrl+C without anything selected or full line selected.

// int x = 5;

现在,如果我选择该行的某些部分并再次按注释按钮,则仅选中的文本将被注释(

Now if I select some part of the line and press comments button again only selected text will be commented (bold means selected)

int x = 5 ;

按Ctrl +后K + Ctrl + C,并且x = 5。

After Pressing Ctrl+K + Ctrl+C with x = 5 selected.

int /*x = 5*/;

多行的情况

int x = 5;

int y = 2;

int z = x * 5;

在注释快捷方式之后

int/* x = 5;
int y = 2;
int z =*/ x * 5;

我想要的东西

//int x = 5;
//int y = 2;
//int z = x * y;

现在这是我不喜欢的。通常,我选择多行,然后按注释按钮。这将仅注释选定的字符,但我希望对所有选定的进行注释。无论如何,可以通过扩展程序还是从Visual Studio设置中进行更改?

Now this is what I don't like. Usually I select multiple lines and press comments button. This will comment only the selected characters, but I want all selected lines tobe commented. Is there anyway to do that any extension or from visual studio settings I can change that?

推荐答案

您必须选择整行(即从该行的第一个字符开始),以便也将c ++注释用于多行。

You have to select the whole line (i.e. from the very first character of the line) in order to use c++ comments for multiple lines too.

更新:如果所选行之间有注释,请按Ctrl +即使选择不是从行首开始,K,Ctrl + C也会生成C ++样式的注释。

Update: if there are comments among the selected lines, Ctrl+K,Ctrl+C will generate C++ style comments even if the selection does not start from the beginning of the lines.

这篇关于Visual Studio C ++多行注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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